2015年12月22日

静态变量-static关键词

摘要: 一、静态变量static用法需声明在@implementaion中,如果声明在@interface或@protocol中:@property (nonatomic, strong) static NSString *s2;报错:Type name does not allow storage cla... 阅读全文

posted @ 2015-12-22 14:36 Beche 阅读(1046) 评论(0) 推荐(0) 编辑

单例模式 & Init(allocWithZone:)

摘要: 一、Init 在分配内存后,子类通过该实例方法,实例化类的新对象。 1、init消息需要在同一行复合alloc方法使用,如SomeClass *obj = [[SomeClass alloc] init]; 2、方法返回值可能为nil,比如在没有相机的设备上新建相机对象就会返回nil。为保证你的创建 阅读全文

posted @ 2015-12-22 14:05 Beche 阅读(375) 评论(0) 推荐(0) 编辑

导航