問題: TableView中 點擊cell presentViewController時 會等待幾秒鐘 或者再次點擊屏幕任何位置才會進(jìn)行跳轉(zhuǎn)
原因:presentViewController可能沒在UI主線程中更新,需要觸發(fā)一個操作,喚醒主線程
解決辦法:兩種都可以
-
將其放在 主線程中執(zhí)行
dispatch_async(dispatch_get_main_queue,^{ [ self presentViewController:VC animated:YES completion:nil ]; }); 讓當(dāng)前VC執(zhí)行一個方法 performSelector
目的:喚醒主線程
Eg:
[self performSelectorOnMainThread:@selector(DoNothing) withObject:nil waitUntilDone:nil];
DoNothing方法可以什么都不做,只是為了喚醒主線程。
(轉(zhuǎn))