摘要: 1 - (void)gcdTest1 { 2 3 4 5 //1.GCD应用 单例模式 6 7 8 9 static dispatch_once_t onceToken; 10 11 dispatch_once(&onceToken, ^{ 12 13 14 15 NSLog(@"执行一次%@... 阅读全文
posted @ 2016-03-22 17:52 憧憬眼前的鱼 阅读(214) 评论(0) 推荐(0)
摘要: 1.线程之间的通信 //有一个特别耗时的操作,比如说网络请求,开启子线程去请求网络,我们一般是要在主线程更新UI,如何从子线程跳转到主线程? #import "ViewController.h" @interface ViewController () @property (weak, nonatomic) IBOutlet UIImageView *imageView; @end ... 阅读全文
posted @ 2016-03-14 22:19 憧憬眼前的鱼 阅读(188) 评论(0) 推荐(0)
摘要: 1 1. 三种创建线程的方法 2 3 //第一种 4 5 NSThread * thread1 = [[NSThread alloc] initWithTarget:self selector:@selector(doAction) object:nil]; 6 7 //线程名 8 9 thread1.name = @"thr... 阅读全文
posted @ 2016-03-14 22:09 憧憬眼前的鱼 阅读(185) 评论(0) 推荐(0)
摘要: 1 #import "ViewController.h" 2 3 #import 4 5 @interface ViewController () 6 7 @property (weak, nonatomic) IBOutlet UIImageView *imageview; 8 9 @property (weak, nonatomic) IBOut... 阅读全文
posted @ 2016-03-14 21:49 憧憬眼前的鱼 阅读(459) 评论(0) 推荐(0)
点击右上角即可分享
微信分享提示