美文网首页
如何获取导航栏控制器push进去的控制器

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

作者: 天空没有太阳 | 来源:发表于2016-07-28 10:25 被阅读65次
[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.

相关文章

网友评论

      本文标题:如何获取导航栏控制器push进去的控制器

      本文链接:https://www.haomeiwen.com/subject/emlajttx.html