关于iOS presentViewController弹出页面反

2018-07-17  本文已影响0人  回忆宇

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

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

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

上一篇下一篇

猜你喜欢

热点阅读