06 2016 档案

摘要:默认类别时无法添加属性的,但可以动态添加,利用runtime机制 #import static const void * externVariableKey =&externVariableKey; @implementation NSObject (Category) @dynamic varia 阅读全文
posted @ 2016-06-30 11:56 春新 阅读(218) 评论(0) 推荐(0)
摘要:共有方法都可以继承下来 @protocol OneDelegate <nsobject> @required - (void)backStr:(NSString *)str; @end @protocol TwoDelegate <onedelegate> @optional - (void)bac 阅读全文
posted @ 2016-06-29 15:59 春新 阅读(145) 评论(0) 推荐(0)
摘要:这种写法有两个好处: 1.节省几个文件。 2.这几个类互相之间不需要再引入。对于别的类,当你引入这个 .h 文件的时候,把这几个类都一起引入了。 第 2 点也可以看做一个破坏封装性的缺点了。所以这样做是比较少见的,仅在定义一些数据结构的时候会这样用。比如像你举的例子中,如果是数据类,里面主要以属性为 阅读全文
posted @ 2016-06-29 15:44 春新 阅读(1471) 评论(0) 推荐(0)
摘要:- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { //在程序启动之后,重写自定义设置的位置 return YES; } -(vo 阅读全文
posted @ 2016-06-28 13:48 春新 阅读(1224) 评论(0) 推荐(0)
摘要:OC的编译器在编译后会在每个方法中加两个隐藏的参数:一个是_cmd,当前方法的一个SEL指针。一个是self,指向当前对象的一个指针。 demo: //应用程序退出后执行代码 - (void)applicationWillTerminate:(UIApplication *)application 阅读全文
posted @ 2016-06-28 11:59 春新 阅读(2441) 评论(0) 推荐(0)
摘要:1.用在.h 文件的@class 和.m文件的#import 替代 .h文件的#import 2.多用字面量 NSNumber *number =@1;替代 NSNumber *number = [NSNumber numberWithInt:1]; 3.多用类型常量,少用宏定义 static ns 阅读全文
posted @ 2016-06-27 14:29 春新 阅读(250) 评论(0) 推荐(0)
摘要:基本的属性和用法: _contentSwitch = [[HMSegmentedControl alloc] initWithSectionTitles:@[MGJLPLocalizedString(@"lifestyle_publish_what_i_posts", @"关注"), MGJLPLo 阅读全文
posted @ 2016-06-27 14:14 春新 阅读(990) 评论(0) 推荐(0)
摘要:谷歌开发的数据库,效率很高。小数据存储可以使用这个,比如搜索的历史记录显示,移除等。大数据使用FMDB. 阅读全文
posted @ 2016-06-24 17:25 春新 阅读(246) 评论(0) 推荐(0)
摘要:- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 阅读全文
posted @ 2016-06-24 17:01 春新 阅读(1554) 评论(0) 推荐(0)
摘要:_block 不仅可以修饰对象也可以修饰基本的数据类型,_weak只能修饰对象. 常见用于防止block的循环包含。 阅读全文
posted @ 2016-06-24 16:42 春新 阅读(113) 评论(0) 推荐(0)