How to get all the application's ViewControllers in iOS?

前端 未结 2 2043
情话喂你
情话喂你 2021-01-21 06:27

How can I get all the ViewControllers of my application at runtime? As far as I know self.navigationcontroller.viewControllers returns the NSArray of only those con

2条回答
  •  既然无缘
    2021-01-21 07:19

    AFAIK there is no such way unless you take care your self of it. You could have access to all navigation controllers but they will only hold currently initialised controllers in the stack. There is always controllers possible that are not in any navi, for example, modal view controllers. I would say you are doing something wrong if you need this :)

    Perhaps the only way to do this is to hold them all in array that you are fully controlling.

提交回复
热议问题