随笔分类 -  多线程

摘要:// // ViewController.m // GCD 定时器 // // #import "ViewController.h" NSInteger count = 0; @interface ViewController () @property (nonatomic, strong)dispatch_source_t time; @end @implementation Vi... 阅读全文
posted @ 2016-05-03 09:24 憧憬眼前的鱼 阅读(154) 评论(0) 推荐(0) 编辑
摘要: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 憧憬眼前的鱼 阅读(213) 评论(0) 推荐(0) 编辑
摘要:1.线程之间的通信 //有一个特别耗时的操作,比如说网络请求,开启子线程去请求网络,我们一般是要在主线程更新UI,如何从子线程跳转到主线程? #import "ViewController.h" @interface ViewController () @property (weak, nonatomic) IBOutlet UIImageView *imageView; @end ... 阅读全文
posted @ 2016-03-14 22:19 憧憬眼前的鱼 阅读(187) 评论(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) 编辑

点击右上角即可分享
微信分享提示