美文网首页
关于iOS presentViewController弹出页面反

关于iOS presentViewController弹出页面反

作者: 回忆宇 | 来源:发表于2018-07-17 17:14 被阅读0次

    想要实现点击tableview中的一个cell,弹出一个页面,在点击cell方法中写presentViewController方法,结果页面弹出速度非常慢,有时几秒钟才能弹出,又是根本不弹出,直到在页面上随意再次点击一下才弹出。
    后来修改了下代码,将presentViewController方法放入主线程中执行:

    dispatch_async(dispatch_get_main_queue(), ^{
                [self presentViewController:VC animated:YES completion:nil];
            });
    
    

    则问题解决。
    由此推断,presentViewController方法不是在UI线程执行

    相关文章

      网友评论

          本文标题:关于iOS presentViewController弹出页面反

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