将一个行数在主线程执行的4中方法
Posted 华少不思议
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了将一个行数在主线程执行的4中方法相关的知识,希望对你有一定的参考价值。
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中方法的主要内容,如果未能解决你的问题,请参考以下文章