上一页 1 ··· 3 4 5 6 7 8 下一页

NSOperation下载图片-01

摘要: 无沙盒缓存 1 #import "HMAppViewController.h" 2 #import "HMApp.h" 3 4 @interface HMAppViewController () 5 /** 6 * 模型数组 7 */ 8 @property (nonatom... 阅读全文
posted @ 2015-03-17 12:02 FKunLam 阅读(129) 评论(0) 推荐(0)

单例-Singleton-03

摘要: 在非ARC中设计单例模式// 在非ARC中,需要重写下面三个方法,这样比较安全- (oneway void)release{ }- (id)retain{ return self;}- (NSUInteger)retainCount{ return 1;} 阅读全文
posted @ 2015-03-16 18:27 FKunLam 阅读(84) 评论(0) 推荐(0)

单例-Singleton-02

摘要: .h文件#import @interface HMDataTool : NSObject+ (instancetype)sharedDataTool;@end.m文件#import "HMDataTool.h"@implementation HMDataTool// 用来保存唯一单例对象static... 阅读全文
posted @ 2015-03-16 17:52 FKunLam 阅读(88) 评论(0) 推荐(0)

单例-Singleton-01

摘要: .h文件#import @interface HMMusicTool : NSObject @property (nonatomic, strong) NSMutableArray *musics;+ (instancetype)shareTool;@end.m文件#import "HMMusicT... 阅读全文
posted @ 2015-03-16 17:24 FKunLam 阅读(127) 评论(0) 推荐(0)

load和initialize

摘要: 1,load// 当类加载到OC运行时环境中(内存),就会调用一次(一个类只会加载一次)+ (void)load{ // 一装入内存就实例化, _instance = [[self alloc] init]; // NSLog(@"load---");}2,initializ... 阅读全文
posted @ 2015-03-16 17:17 FKunLam 阅读(106) 评论(0) 推荐(0)

OC中的static-01

摘要: static:修饰变量1》修饰局部变量:*局部变量的生命周期 根 全局变量 类似*但是不能改变作用域*能够保证局部变量永远只初始化一次,在程序运行过程中,永远只有1分内存2》修饰全局变量*全局变量的作用域仅限于当前文件内部 阅读全文
posted @ 2015-03-16 16:37 FKunLam 阅读(106) 评论(0) 推荐(0)

GCD-06

摘要: 延迟1》perform3秒后自动回到当前线程调用self的download:方法,并且传递参数:@"http://555.jpg"// 一旦定制好延迟任务后,不会卡主当前线程, [self performSelector:@selector(download:) withObject:@"http... 阅读全文
posted @ 2015-03-16 15:30 FKunLam 阅读(104) 评论(0) 推荐(0)

GCD-05

摘要: 队列组(dispatch_group_t) 阅读全文
posted @ 2015-03-16 15:23 FKunLam 阅读(81) 评论(0) 推荐(0)

GCD-04

摘要: GCD-一次性代码static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ NSLog(@"---download image---"); });使用dispatch_once函数能保证某段代码在程序运行过程中只被执行1次 阅读全文
posted @ 2015-03-16 13:59 FKunLam 阅读(62) 评论(0) 推荐(0)

GCD-03

摘要: 1,队列和任务1)任务:需要执行什么操作*用block来封装任务2)队列:存放任务*全局的并发队列:可以让任务并发执行dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);*自己创... 阅读全文
posted @ 2015-03-16 11:45 FKunLam 阅读(129) 评论(0) 推荐(0)
上一页 1 ··· 3 4 5 6 7 8 下一页