在控制台里打印controller的层级

本文详细介绍了如何在iOS开发中利用控制台输出UIViewController的层级结构,以便于理解NavigationController中的视图控制器组织关系。通过打印每个ViewController的tag和父视图控制器,开发者可以清晰地查看controller在导航栈中的位置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

(lldb) po [UIViewController _printHierarchy]
<BaseTabBarController 0x280f600>, state: appeared, view: <UILayoutContainerView 0x3b64990>
   | <UINavigationController 0x284dc00>, state: disappeared, view: <UILayoutContainerView 0x3b31e40> not in the window
   |    | <MasterViewController 0x288a000>, state: disappeared, view: <UIView 0x3993870> not in the window
   | <UINavigationController 0x293d000>, state: disappeared, view: <UILayoutContainerView 0x3b71860> not in the window
   |    | <MessageViewController 0x3b70d90>, state: disappeared, view: <UIView 0xae475a0> not in the window
   | <UINavigationController 0x286d400>, state: disappeared, view: <UILayoutContainerView 0x3b74790> not in the window
   |    | <FarmViewController 0x3b73d90>, state: disappeared, view: <UIView 0xae2d430> not in the window
   | <UINavigationController 0x2943a00>, state: appeared, view: <UILayoutContainerView 0x3b7a810>
   |    | <PersonViewController 0x293d400>, state: disappearing, view: <UIView 0x3bf6340>
   |    | <InformationViewController 0x40eb000>, state: disappeared, view: <UIView 0xe114340> not in the window
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值