关于CELL 跳转到view controller 卡顿

问题: 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 卡顿)