什么会导致pushViewController速度极慢?(新视图的出现需要30+seconds )
基本上,我在做这样的事情:
SecondViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"correctID"];
vc.something = something;
[self.navigationController pushViewController:vc animated:YES];
CLS_LOG(@"Pushed Controller...");我在第二个视图控制器中的视图加载开始时记录日志。我没有对其他方法进行子类化。
在推送控制器之间..。下一个日志从视图加载,有一个巨大的延迟。
您将如何调试这个?
我已经试过使用TimeProfiler了,但很明显,它没有显示出什么。
发布于 2014-09-10 00:14:18
之前有类似的问题,请尝试以下方法
dispatch_async(dispatch_get_main_queue(), ^{
// your navigation controller action goes here
});发布于 2018-05-23 07:16:38
迪诺的回答救了我一命。他得到了我的支持。我只是为现代快速用户添加这个。
DispatchQueue.main.async {
self.navigationController?.pushViewController(vc, animated: true)
}发布于 2019-03-28 20:27:13
设置背景色,例如vc.view.backgroundColor = .white为我解决了这个问题。
https://stackoverflow.com/questions/25754629
复制相似问题