performSelector

performSelector

是当前线程异步

//主线程同步

[self performSelectorOnMainThread:@selector(performMethodAsync:) withObject:nil waitUntilDone:YES];

//主线程异步

[self performSelectorOnMainThread:@selector(performMethodAsync:) withObject:nil waitUntilDone:YES];

NSNotification 是当前线程 同步

2. 为何要在主线程更新ui

因为子线程中对所有其他ui更新都要等到该子线程生命周期结束才进行。

原文地址:https://www.cnblogs.com/apem/p/4334596.html