如何打印特定视图控制器的视图层次结构?(How to print view hierarchy of a specific view controller?)
我在控制台中发出以下调用并获得视图层次结构。
(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的视图层次结构? 可以以某种方式使用视图控制器的地址吗?
I issue the following call in the console and got the view hierarchy.
(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>How do I print the view hierarchy for MyApp.ViewController? Can the address of the view controller be used somehow?
最满意答案
只需输入lldb命令即可
expr -l objc++ -O -- [0x13ee13b50 _printHierarchy]其中0x13ee13b50是您感兴趣的视图控制器的地址。
Just enter the lldb command
expr -l objc++ -O -- [0x13ee13b50 _printHierarchy]where 0x13ee13b50 is the address of the view controller that you are interested in.
更多推荐
发布评论