如何打印特定视图控制器的视图层次结构?(How to print view hierarchy of a specific view controller?)

编程入门 行业动态 更新时间:2024-10-25 13:25:11
如何打印特定视图控制器的视图层次结构?(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.

更多推荐

本文发布于:2023-08-07 19:05:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1465523.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:视图   控制器   层次   结构   print

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!