我在控制台中发出以下调用并获得了视图层次结构。
(lldb)expr -l objc ++ -O - [[[UIWindow keyWindow] rootViewController] _printHierarchy]
<TestViewController 0x13ee07360>, state: appeared, view: <TestView 0x13ed10520>
| <MyApp.MenuController 0x13ee126b0>, state: disappeared, view: (view not loaded)
| <UINavigationController 0x13ee15b60>, state: appeared, view: <UILayoutContainerView 0x13ed16b80>
| | <MyApp.ViewController 0x13ee13b50>, state: appeared, view: <UIView 0x13ee1d700>
如何打印MyApp.ViewController的视图层次结构?可以以某种方式使用视图控制器的地址吗?
答案 0 :(得分:4)
只需输入lldb命令
即可expr -l objc++ -O -- [0x13ee13b50 _printHierarchy]
其中0x13ee13b50是您感兴趣的视图控制器的地址。