如何获取导航栏控制器push进去的控制器

[self.navigationController pushViewController:view animated:YES];

viewControllers:// The current view controller stack.

如何一个导航栏控制器push了十几个页面,你想获取这是几个页面的话,那么就可以通过* viewControllers*来查看。

另外还有一个属性可以获取childViewControllers,该属性也是返回一个数组,但是两者还是有些区别的。

  • childViewControllers是属于UIViewController的属性,而viewControllers属于UINavigationViewController的属性
  • childViewControllers不包含presented进来的控制器 官方API:

This property does not include any presented view controllers. This property is only intended to be read by an implementation of a custom container view controller.

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • /* UIViewController is a generic controller base class th...
    DanDanC阅读 1,853评论 0 2
  • 更好的阅读体验,请到个人博客阅读: iOS中的系统转场 请忽略标题,😂,本文记录的是对下图所示的Kind, Pre...
    CaryaLiu阅读 2,382评论 0 1
  • 1 UIViewController机制 1.1 生命周期 理解view的生命周期: 在UIViewControl...
    Kevin_Junbaozi阅读 1,641评论 0 1
  • 1.自定义控件 a.继承某个控件 b.重写initWithFrame方法可以设置一些它的属性 c.在layouts...
    圍繞的城阅读 3,463评论 2 4
  • 亲爱的老公,你一直以严厉著称,儿子比较怕你,什么事都不愿意和你说。自从开学后,你主动承担起了辅导儿子的学习任务,每...
    舒望_04ee阅读 168评论 0 3