IOS多线程--回调主线程

回调主线程

(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:^{

原文地址:https://www.cnblogs.com/gaduo/p/4994330.html