推送UIViewController时延迟很长

时间:2014-02-05 23:54:43

标签: ios

我遇到了一个奇怪的问题,在我的控制器出现之前推送自定义UIViewController会导致很长的延迟。如果我改变我的代码来呈现控制器而不是推动它,那就没有延迟了。

当我创建并推送我的VC时,我没有做任何奇特的事情:

MyCustomViewController *myView = [[MyCustomViewController alloc] init];
NSLog(@"myView init done");
[[self navigationController] pushViewController:tagsView animated:YES];
NSLog(@"myView PUSHED");
// switching this to [self presentViewController:myView animated:YES completion:nil] gets rid of the delay

我添加了一些日志,试图确定延迟发生的确切时间。上面的NSLogs按预期快速打印:

myView init done
myView PUSHED

然后在所有这些行打印之前有一个很长的延迟,可能是20-30秒:

ViewController loadView begins
ViewController loadView ends
ViewController viewDidLoad begins
ViewController viewDidLoad ends
ViewController viewWillAppear begins
ViewController viewWillAppear ends
willShowViewController
ViewController viewDidAppear here
didShowViewController

所有ViewController日志显然来自我的UIViewController,*ShowViewController来自我的UINavigationController委托。我的viewController的所有方法似乎都在快速运行。正如我所提到的,如果我在代码中的这一点上提供相同的控制器,则没有延迟。我的UINavigationController可以导致这种状态吗?任何建议都会非常感激。

0 个答案:

没有答案