首页 > 编程语言 > 详细

将一个行数在主线程执行的4中方法

时间:2016-11-17 01:48:30      阅读:324      评论:0      收藏:0      [点我收藏+]

 1-GCDblockblock

dispatch_async(dispatch_get_main_queue(), ^{

});

2-NSOperation

NSOperationQueue *mainQueue = [NSOperationQueue

mainQueue];

NSBlockOperation *operation = [NSBlockOperation

blockOperationWithBlock:^{

}];

[mainQueue addOperation:operation];

3-NSThread

[selfperformSelector:@selector(method)

onThread:[NSThread mainThread] withObject:nilwaitUntilDone:YESmodes:nil];

[selfperformSelectorOnMainThread:@selector(method)

withObject:nilwaitUntilDone:YES];

[[NSThread mainThread] performSelector:

@selector(method) withObject:nil];

4-RunLoop

[selfperformSelectorOnMainThread:@selector(method)

withObject:nilwaitUntilDone:YES];

[[NSThread mainThread] performSelector:

@selector(method) withObject:nil];

? RunLoop

[[NSRunLoop mainRunLoop] performSelector:@selector(method) withObject:nil];

将一个行数在主线程执行的4中方法

原文:http://www.cnblogs.com/CJH5209/p/6072149.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!