【发布时间】:2014-09-09 22:37:10
【问题描述】:
什么可能导致 pushViewController 非常慢? (新视图出现需要 30 多秒)
基本上,我正在做这样的事情:
SecondViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"correctID"];
vc.something = something;
[self.navigationController pushViewController:vc animated:YES];
CLS_LOG(@"Pushed Controller...");
我在第二个视图控制器内的 viewdidload 开头记录。 我没有继承其他方法。
在 Pushed Controller... 和 viewdidload 的下一个日志之间有很大的延迟。
你会如何调试这个?
我已经尝试过使用 TimeProfiler,但显然它什么也没显示。
【问题讨论】:
-
我猜想您的 SecondViewController 的
viewDidLoad、viewWillAppear或viewDidAppear方法中的某些内容需要很长时间。只是为了调试,尝试注释掉他们的内容,看看是什么导致了你的问题。 -
您确定在主线程中运行该代码吗?向我们展示更多背景信息。
标签: ios objective-c