- 博客(38)
- 收藏
- 关注
转载 用runtime来重写Coder和deCode方法 归档解档的时候使用
当我们归档自定义对象的时候,可以重写自定义Model的的encodeWithCoder和initWithCoder 开始的大概是这样的,当属性非常多的时候 这种方式就会觉得不还好 好像重复在做一样的事情 其实这块我们可以交给runtime来做 - (void)encodeWithCoder:(NSCoder *)aCoder //将属性进行编码 { [aCoder e...
2016-04-06 11:31:00
227
转载 Homebrew安装卸载
安装homebrew ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 卸载homebrew ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebr...
2016-03-25 22:13:00
303
转载 Cannot create a new pixel buffer adaptor with an asset writer input that has already started writing...
reason: '*** -[AVAssetWriterInputPixelBufferAdaptor initWithAssetWriterInput:sourcePixelBufferAttributes:] Cannot create a new pixel buffer adaptor with an asset writer input that has already sta...
2016-03-04 15:40:00
276
转载 OSX下面用ffmpeg抓取桌面以及摄像头推流进行直播
参考博客 http://blog.chinaunix.net/uid-11344913-id-4665455.html 在osx系统下通过ffmpeg查看设备 ffmpeg -f avfoundation -list_devices true -i "" 显示结果如下: SingerdeMacBook-Pro:~ Singer$ ffmpeg -f av...
2016-03-02 00:33:00
1142
转载 让nginx支持HLS
准备工作: 1.安装nginx和rtmp模块 2.安装ffmepg(用来推流) 以上准备工作参见这篇博客:http://www.cnblogs.com/damiao/p/5231221.html 1.配置nginx 用记事本工具打开 /usr/local/etc/nginx/nginx.conf 找到server 修改 server { ...
2016-03-01 15:59:00
280
转载 OSX安装nginx和rtmp模块(rtmp直播服务器搭建)
参考文章: https://github.com/Homebrew/homebrew-nginx 1.安装Homebrew,执行命令 ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 2.执行命令: brew tap homebrew/n...
2016-03-01 15:31:00
201
转载 iOS 字典转json字符串
NSDictionary *param = @{@"key1":@"value1",@"key2":@"value2"}; NSError *parseError = nil; NSData *jsonData = [NSJSONSerialization dataWithJSONObject:param options:NSJSONWritingPrettyPrinte...
2016-01-25 18:06:00
460
转载 iOS 七牛多张图片上传
-(void)uploadImages:(NSArray *)images atIndex:(NSInteger)index token:(NSString *)token uploadManager:(QNUploadManager *)uploadManager keys:(NSMutableArray *)keys{ UIImage *image = images[i...
2016-01-13 16:22:00
305
转载 iOS9UICollectionView自定义布局modifying attributes returned by UICollectionViewFlowLayout without copying...
UICollectionViewFlowLayout has cached frame mismatch This is likely occurring because the flow layout subclass MyLineLayout is modifying attributes returned by UICollectionViewFlowLayout with...
2016-01-05 11:22:00
240
转载 Xcode6 iOS7模拟器和Xcode7 iOS8模拟器离线下载
Xcode6 只支持iOS7和iOS8的模拟器 Xcode7 只支持iOS9和iOS8的模拟器 Xcode 并不会识别 SDKs 目录下的模拟器,我经过一些尝试以后,发现要放在这个目录下: /Library/Developer/CoreSimulator/Profiles/Runtimes/ 注意:是根目录,不在 Xcode 和 User 的目录下 而且与旧版的模拟器不同,新版...
2015-10-22 15:43:00
400
转载 Push导航栏黑影问题
解决方法可以在自定义的 TabbarViewController里 viewDidLoad方法里 self.view.backgroundColor = [UIColor whiteColor]; 如果没有自定义tabbarController的话可以这样 self.navigationController.view.backgroundColor = [UIColo...
2015-09-06 21:38:00
129
转载 处理 CALayer 变形后的抗锯齿问题
处理锯齿当然要用抗锯齿,iOS 可以通过修改 Plist 实现全局抗锯齿,但是这样容易出现性能问题。 所以就要使用对单个 Layer 开启抗锯齿的方法 layer.allowsEdgeAntialiasing = true 摘自:《Producter》 转载于:https://www.cnblogs.com/damiao/p/4771579.html...
2015-08-30 20:37:00
274
转载 SDWebImage支持WebP格式图片
SDWebImage本身就已经支持了webp格式的图片 1.下载libwebp https://github.com/webmproject/libwebp 然后你需要先安装好有homebrew或者macports 安装homebrewh很简单,执行一条命令即可 ruby -e "$(curl -fsSL https://raw.githubusercontent.c...
2015-06-08 22:51:00
321
转载 解决CIFilter滤镜后图片大小和方向发生变化
调用contextWithOptions:和createCGImage: fromRect:方法创建CIContext。与以往不同的地方是CIImage没有frame与bounds属性;只有extent属性。你将非常频繁的使用这个属性作为createCGImage: fromRect:方法的第二个参数 摘自:http://www.cocoachina.com/industry/20...
2015-05-28 18:31:00
618
转载 Xcode更新后插件失效解决办法
defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID 获取新版xcode的uuid Xcode6.3.2显示E969541F-E6F9-4D25-8158-72DC3545A6C6 find ~/Library/Application\ Support/Deve...
2015-05-27 09:48:00
172
转载 iOS录音后播放声音小,AudioSessionInitialize failed,AudioQueueStart failed (-50)
方法1: UInt32 audioRoute = kAudioSessionOverrideAudioRoute_Speaker; AudioSessionSetProperty(kAudioSessionProperty_OverrideAudioRoute, sizeof(audioRoute), &audioRoute); 方法2: [[A...
2015-05-22 00:08:00
531
转载 NSAttributedString描述
字符属性 字符属性可以应用于 attributed string 的文本中。 NSString *const NSFontAttributeName;(字体) NSString *const NSParagraphStyleAttributeName;(段落) NSString *const NSForegroundColor...
2015-05-09 20:56:00
95
转载 删除光标前的字符
UITextPosition* beginning = _commentTextView.beginningOfDocument; UITextRange* selectedRange = _commentTextView.selectedTextRange; UITextPosition* selectionStart = selectedRang...
2015-05-06 11:02:00
1470
转载 离线下载Xcode的文档
https://developer.apple.com/library/downloads/docset-index.dvtdownloadableindex 找到里面的文档下载地址 例如iOS 8.3的离线文档下载地址,把地址复制下来用迅雷下载就快多了 https://devimages.apple.com.edgekey.net/docsets/20150408/Xcod...
2015-04-28 22:05:00
207
转载 Base64把图片、文件转码成字符串(互转)
文件Base64以后会翻倍的涨,例如一张52kb的图片 base64以后string文件大小为185kb,在通过string转回图片为135kb 图片转文字: UIImage *_originImage = [UIImage imageNamed:@"0.jpg"]; NSData *_data = UIImageJPEGRepresentation(_orig...
2015-04-27 22:40:00
1150
转载 备份Xcode6的配色主题以及代码模板
~/Library/Developer/Xcode/UserData/FontAndColorThemes ~/Library/Developer/Xcode/UserData/CodeSnippets Xcode6备份这2个目录即可 转载于:https://www.cnblogs.com/damiao/p/4422001.html...
2015-04-13 13:49:00
122
转载 iOS Framework lipo报错 lipo: can't map input file
fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: can't map input file: xxxFramework.framework/ (Invalid argument) 原因在于: lipo -info ...
2015-04-10 23:40:00
1324
转载 iOS单例 宏定义
#define singleton_interface(className) \ + (className *)shared##className; // @implementation #define singleton_implementation(className) \ static className *_instance; \ + (id)allocWi...
2015-04-08 23:16:00
167
转载 iOS截图
UIView *cutView = self.view.window.rootViewController.view; //截图 //开启上下文 UIGraphicsBeginImageContextWithOptions(cutView.frame.size, YES, 0.0); //把cutView渲染到上下文中 [cutV...
2015-04-07 19:09:00
194
转载 typedef block
给同一种类型的block定义一个别名 typedef int (^MyBlock) (int , int); int main(int argc, const char * argv[]) { @autoreleasepool { MyBlock sumBlock = ^(int a , int b){ return ...
2015-04-07 19:07:00
111
转载 iOS的几种定时器
//gcd的定时器timer必须先保存为一个属性或者成员变量 @property (nonatomic , assign) dispatch_source_t timer; //第一种 每一秒执行一次(重复性) double delayInSeconds = 1.0; //每间隔1秒执行 timer = dispatch_source_c...
2015-04-07 19:03:00
134
转载 CocoaPods pod install/pod update更新慢的问题
最近使用CocoaPods来添加第三方类库,无论是执行pod install还是pod update都卡在了Analyzing dependencies不动 原因在于当执行以上两个命令的时候会升级CocoaPods的spec仓库,加一个参数可以省略这一步,然后速度就会提升不少。加参数的命令如下: pod install --verbose --no-repo-update ...
2015-04-07 18:58:00
256
转载 iOS设置导航栏样式(UINavigationController)
//设置导航栏baritem和返回baiitem样式 UIBarButtonItem *barItem = [UIBarButtonItem appearance]; //去掉返回按钮上的字 [barItem setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60) forBarMetrics:UIBarMetri...
2015-04-07 18:51:00
329
转载 IAP内购
IAPHelper.h // // IAPHelper.h // airplay // // Created by apple on 13-10-23. // Copyright (c) 2013年 itcast. All rights reserved. // #import <Foundation/Foundation.h> type...
2015-04-05 19:31:00
260
转载 设置UIButton文字大小颜色不同
_loginBtn = [[UIButton alloc]initWithFrame:CGRectMake(iconX, CGRectGetMaxY(passwordBGView.frame)+25, 280, 35)]; [_loginBtn setTitle:@"进入游戏\nSTART GAME" forState:UIControlStateNormal]; _loginB...
2015-04-05 19:21:00
102
转载 AFNetworking上传文件
-(void)upload{ AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; NSDictionary *params = @{@"deviceName":@"imageName",@"deviceId":@"1",@"deviceChildId":...
2015-04-05 19:18:00
88
转载 解决UITableView头部空白
解决方式1: self.tableView.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, self.tableView.bounds.size.width, 0.01f)]; 解决方式2: self.tableView.contentInset = UIEdgeInsetsMak...
2015-04-05 19:16:00
206
转载 iOS获取文件和文件夹大小
//通常用于删除缓存的时,计算缓存大小 //单个文件的大小 - (long long) fileSizeAtPath:(NSString*) filePath{ NSFileManager* manager = [NSFileManager defaultManager]; if ([manager fileExistsAtPath:filePath]){ ...
2015-04-05 19:15:00
425
转载 编译ffmpeg(iOS)
一,x264库的编译 首先到http://www.videolan.org/developers/x264.html下载x264的库,然后解压,修改文件夹名称为x264 二,下载ffmpeg2.x http://ffmpeg.org/releases/ 例如:http://ffmpeg.org/releases/ffmpeg-2.5.3.tar.bz2下载并解...
2015-04-05 19:09:00
113
转载 让MySql支持Emoji表情
解决方案:将Mysql的编码从utf8转换成utf8mb4。 需要 >= MySQL 5.5.3版本、从库也必须是5.5的了、低版本不支持这个字符集、复制报错 停止MySQL Server服务 修改 my.cnf或者mysql.ini [client] default-character-set = utf8mb4 [mysql] default-characte...
2015-04-05 19:03:00
146
转载 MySQL重置密码(OSX)
1.停止MySQL的服务 sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop 2.cd /usr/local/mysql/bin ./mysqld_safe --skip-grant-table 3.新开个终端 也是进入到mysql/bin目录 ./mysql -u root mysql use mysql; U...
2015-04-05 19:01:00
110
转载 iOS多线程总结
1.不要同时开太多的线程(1~3条线程即可,不要超过5条) 2.线程概念 1> 主线程 : UI线程,显示、刷新UI界面,处理UI控件的事件 2> 子线程 : 后台线程,异步线程 3.不要把耗时的操作放在主线程,要放在子线程中执行 一、NSThread(掌握) 1.创建和启动线程的3种方式 1> 先创建,后启动 // 创建 NSThrea...
2015-04-05 10:40:00
118
转载 static和extern的区别
extern(外部) 1.对函数 完整的定义一个外部函数(可以省略extern) 完整的声明一个外部函数(可以省略extern) 2.对变量 只能声明一个外部变量(不能省略extern) 在函数里面定义extern的变量表示应用程序中其他地方的变量(引用某个全局变量,并非定义) static(内部) 1.对函数 定...
2015-04-05 10:25:00
319
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅