本文介绍了viewWillDisappear和viewDidDisappear之间的巨大延迟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是日志输出
2013-03-16 14:02:59.301 Echo[65406:4503] child viewWillDisappear start
2013-03-16 14:02:59.303 Echo[65406:4503] child viewWillDisappear returning
2013-03-16 14:02:59.303 Echo[65406:4503] parent viewWillAppear start
2013-03-16 14:02:59.305 Echo[65406:4503] parent viewWillAppear returning
2013-03-16 14:02:59.307 Echo[65406:4503] parent finished calling popToRootViewControllerAnimated on child.navigationController
2013-03-16 14:03:30.120 Echo[65406:c07] child viewDidDisappear start
2013-03-16 14:03:30.121 Echo[65406:c07] child viewDidDisappear returning
2013-03-16 14:03:30.121 Echo[65406:c07] parent viewDidAppear start
2013-03-16 14:03:30.122 Echo[65406:c07] parent viewDidAppear returning
viewWillDisappear
和 viewDidDisappear
。
推荐答案
这里的问题是线程。这是因为此操作是在AFNetworking代码的回调。而不是使用:
The problem here was threads. It is because this action was in a callback from AFNetworking code. Instead of using:
[controller.navigationController popViewControllerAnimated:NO];
需要:
// http://stackoverflow.com/questions/9411271/how-to-perform-uikit-call-on-mainthread-from-inside-a-block
dispatch_async(dispatch_get_main_queue(), ^{
[controller.navigationController popViewControllerAnimated:NO];
[self.navigationController pushViewController:newController animated:YES];
});
这篇关于viewWillDisappear和viewDidDisappear之间的巨大延迟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!