美文网首页iOS进阶指南
TableView中presentViewController时

TableView中presentViewController时

作者: ManoBoo | 来源:发表于2015-12-07 14:49 被阅读1093次

TableView中 点击cell presentViewController时 会等待几秒钟 或者再次点击屏幕任何位置才会进行跳转
原因:
【/】presentViewController可能没在UI主线程中更新,需要触发一个操作,唤醒主线程

解决办法:两种都可以
1.将其放在 主线程中执行
dispatch_async(dispatch_get_main_queue,^{
[ self presentViewController:VC animated:YES completion:nil ] ;
});
2.让当前VC执行一个方法 performSelector
目的:唤醒主线程
Eg: [self performSelectorOnMainThread:@selector(DoNothing) withObject:nil waitUntilDone:nil];
DoNothing方法可以什么都不做,只是为了唤醒主线程。

相关文章

网友评论

    本文标题:TableView中presentViewController时

    本文链接:https://www.haomeiwen.com/subject/cwrehttx.html