美文网首页
关于CELL 跳转到view controller 卡顿

关于CELL 跳转到view controller 卡顿

作者: 午夜大鸟王 | 来源:发表于2016-07-13 10:05 被阅读167次

问题: 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方法可以什么都不做,只是为了唤醒主线程。

(转)

相关文章

网友评论

      本文标题:关于CELL 跳转到view controller 卡顿

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