简体   繁体   English

一个不相关的UIViewController的viewDidLoad被调用

[英]viewDidLoad of an unrelated UIViewController is getting called

While debugging a problem, I noticed that when changing orientation, the viewDidLoad of an unrelated UIViewController is getting called. 在调试问题时,我注意到在更改方向时,将调用不相关的UIViewControllerviewDidLoad

It appears to be unrelated to my problem, but it's totally weird. 它似乎与我的问题无关,但是完全奇怪。

This UIViewController is accessible only from the UITabBar (in the storyboard itself) 只能从UITabBar (在情节UITabBar UIViewController )访问此UIViewController

If testing this on iOS 8, you can look at the view controller hierarchy by running the app, pausing execution by hitting the "pause" button: 如果在iOS 8上进行测试,则可以通过运行应用程序查看视图控制器层次结构,并通过单击“暂停”按钮来暂停执行:

暂停

Then, at the (lldb) prompt, enter the command 然后,在(lldb)提示符下,输入命令

po [UIViewController _printHierarchy]

This can identify which view controllers are in the view hierarchy. 这可以标识视图层次结构中的视图控制器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM