回调主线程
(1)NSThread
1.performSelectorOnMainThread调用主线程的方法、
[self performSelectorOnMainThread:@selector(finish) withObject:self waitUntilDone:NO];
2.回调其她子线程也是可以的,但是不用
self performSelector:
(2)GCD
dispatch_async(dispatch_get_main_queue(), ^{
(3)NSOperation
NSOperationQueue *mainQueue = [NSOperationQueue mainQueue];
[mainQueue addOperationWithBlock:^{
时间: 2024-11-09 02:07:46