代码改变世界

ARC

2015-08-19 20:56 by dengchaojie_learner, 101 阅读, 0 推荐, 收藏, 编辑
摘要:旧工程配置arc方案:邓超界:weak只适用于ARC的.m文件 1,直接在targets->build phases中修改compiler Flags,是否支持arc。添加:-fobjc-arc,就可以让旧项目支持arc。如果想让原来支持arc的不使用arc则添加-fno-objc-arc 阅读全文

获取设备型号

2015-08-19 20:55 by dengchaojie_learner, 192 阅读, 0 推荐, 收藏, 编辑
摘要:6和6 plus真机测试报错:No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=arm64, VALID_ARCHS=armv7 arm7s)。解决方法是设置”Build Active Architecture On... 阅读全文

NSNotificationCenter

2015-08-19 20:54 by dengchaojie_learner, 126 阅读, 0 推荐, 收藏, 编辑
摘要:Observer可以用self.collectView // 2.监听收藏改变通知,并刷新数据 [[NSNotificationCenter defaultCenter] addObserver:self.collectionView selector:@selector(reloadData) n 阅读全文

Dictionary

2015-08-19 20:53 by dengchaojie_learner, 169 阅读, 0 推荐, 收藏, 编辑
摘要:对象 转换成 整型、浮点型。 intValue、floatValue cellDic[@"preFillValue"] floatValue] cellDic[@"unactivated"] intValue] [_citiesData valueForKeyPath:@"name"]; KVC(s 阅读全文

block

2015-08-19 20:52 by dengchaojie_learner, 162 阅读, 0 推荐, 收藏, 编辑
摘要:block方法和代理是可以互换的。 block只能用copy,用strong是没用的: @property (nonatomic, copy) void (^hideBlock)();// 没有返回值,没有参数 @property (nonatomic, copy) void (^setTitleB 阅读全文

iPad

2015-08-19 20:51 by dengchaojie_learner, 160 阅读, 0 推荐, 收藏, 编辑
摘要:2.在Ipad开发中,控制器view,默认,宽度取尺寸最小的值,高度取尺寸最大的值,高度永远大于宽度 3.面试题:如何做好Ipad屏幕旋转适配问题?解决方案:在主控制器先加个UIView(内容view), 之后将子控制器作为这个内容view的子视图就行了 阅读全文

NSString

2015-08-19 20:50 by dengchaojie_learner, 185 阅读, 0 推荐, 收藏, 编辑
摘要:string.uppercaseString,转换成大写 NSLog(@"%@",NSStringFromCGRect(self.view.frame));// NSStringFromCGRect,将CGRect转成字符串 犯了一个严重的错误: //1.2 删除拓展名 NSString *imgN 阅读全文

xib和storyboard的使用方法

2015-08-19 20:43 by dengchaojie_learner, 226 阅读, 0 推荐, 收藏, 编辑
摘要:initWithNibName加载xib或者storyboard // VC BLEViewController *controller = [[BLEViewController alloc] initWithNibName:@"BLEViewController" bundle:nil]; // 阅读全文

drawRect画线和使用CGContext

2015-08-19 20:42 by dengchaojie_learner, 241 阅读, 0 推荐, 收藏, 编辑
摘要:Quartz 2D绘图引擎,核心对象就是上下文 画线的一个自定义UILable -(void)drawRect:(CGRect)rect { [super drawRect:rect]; // 1.获得上下文 CGContextRef ctx = UIGraphicsGetCurrentContex 阅读全文

CGAffineTransform动画

2015-08-19 20:41 by dengchaojie_learner, 156 阅读, 0 推荐, 收藏, 编辑
摘要:NSTimer只适合做频率比较低的事情,每隔多少秒做什么事情。 CADisplayLink适合做频率比较高的事情。 [UIView beginAnimations:nil context:nil]; self.contentView.frame = frame; [UIView commitAnim 阅读全文