摘要: /* block要掌握的东西 1> 如何定义block变量 int (^sumBlock)(int, int); void (^myBlock)(); 2> 如何利用block封装代码 ^(int a, int b) { return a - b; }; ^() { NSLog(@"----------"); }; ^ { NSLog(@"... 阅读全文
posted @ 2016-03-24 18:35 EricSun 阅读(88) 评论(0) 推荐(0) 编辑
摘要: 在封装的类方法内部,也就是+ (id)personWithName:(NSString *)name andAge:(int)age内部: 创建了一个person对象,并且创建了一个person*类型的指针p1指向这个对象。 此时不用考虑指针p1对新创建对象retaincount的影响,因为此时(创 阅读全文
posted @ 2016-03-24 15:36 EricSun 阅读(265) 评论(0) 推荐(0) 编辑
摘要: //写法一: @interface Person : NSObject { } @property (nonatomic, strong) NSString *name; @end @implementation Person @end //这个适用与一般情况,编译器自动生成成员变量_name,而且写法最简单,不必重复声明。 //写法二,针对继承情况下,向子类暴露父类成员变量: @inter... 阅读全文
posted @ 2016-03-24 14:23 EricSun 阅读(180) 评论(0) 推荐(0) 编辑
摘要: By default, a readwrite property will be backed by an instance variable, which will again be synthesized automatically by the compiler. An instance va 阅读全文
posted @ 2016-03-24 13:58 EricSun 阅读(151) 评论(0) 推荐(0) 编辑