didSeletedRowAtIndexPath方法调用UIAlertController会卡顿,求解!
didSeletedRowAtIndexPath 估计这个方法是异步执行的,曾经使用 [tableView selectRowAtIndexPath: animated: scrollPosition:]
崩掉了,但是使用 [Controller tableView: didSelectRowAtIndexPath:]
不崩。在cell的数据源方法里调用的,但是打印出的信息来看,didSelectRowAtIndexPath: 是等数据源方法全部执行完之后才调用。
有很多人遇到过类似的问题, 好像是个 bug, 你试试切换到主线程来显示 UIAlertController:
dispatch_async(dispatch_get_main_queue(), ^{
[self presentViewController:alertController animated:YES completion:nil];
});
按理来说不应该是这样的, 因为 didSelectRowAtIndexPath 应该也是在主线程执行的。