摘要: // cmd + n 新建Header File 文件名: Singleton.h// .h#define singleton_interface(className) + (instancetype)shared##className;// .m// 注意:最后一句不要斜线#define singleton_implementation(className) \static className *_instace; \\+ (id)allocWithZone:(struct _NSZone *)zone \{ \ static dispatch_once_t onceToken; \ ... 阅读全文
posted @ 2014-01-09 14:50 yuan555 阅读(181) 评论(0) 推荐(0) 编辑
摘要: 1 #pragma mark - 谓词基本使用 2 - (void)demo1 3 { 4 // 谓词的用处是用来判断对象是否符合某种要求 5 // predicateWithFormat指定谓词匹配的条件 6 NSPredicate *predicate = [NSPredicate predicateWithFormat:@"self CONTAINS 'ao'"]; 7 8 NSString *str = @"hello"; 9 10 // 用谓词来匹配字符串11 if ([predicate evaluateWithO... 阅读全文
posted @ 2014-01-09 14:41 yuan555 阅读(197) 评论(0) 推荐(0) 编辑