pushViewController 极慢 [英] pushViewController Extremely slow

查看:90
本文介绍了pushViewController 极慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么会导致 pushViewController 非常慢?(新视图出现需要 30+ 秒)

What could cause pushViewController to be extremely slow? (it takes 30+seconds for the new view to appear)

基本上,我正在做这样的事情:

Basically, I'm doing something like this:

SecondViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"correctID"];
vc.something = something;
[self.navigationController pushViewController:vc animated:YES];
CLS_LOG(@"Pushed Controller...");

并且我在第二个视图控制器中的 viewdidload 开始处记录.我没有继承其他方法.

and i'm logging at the beginning of viewdidload inside the second view controller. I'm not subclassing other methods.

在推送控制器...和来自 viewdidload 的下一个日志之间存在巨大延迟.

Between Pushed Controller... and the next log from viewdidload there's a huge delay.

你将如何调试它?

我已经尝试过 TimeProfiler,但显然它什么也没显示.

I already tried with the TimeProfiler but apparently it shows nothing.

推荐答案

之前遇到过类似问题,试试下面的方法

Had similar problem before, try the following

dispatch_async(dispatch_get_main_queue(), ^{
    // your navigation controller action goes here
});

这篇关于pushViewController 极慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆