Iterating 'Active' View Controllers
        Posted  
        
            by ISDi
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by ISDi
        
        
        
        Published on 2010-04-10T22:24:39Z
        Indexed on 
            2010/04/10
            22:33 UTC
        
        
        Read the original article
        Hit count: 326
        
Ola Folks,
In an iPhone application I am displaying different views by using the addSubView:SomeViewController.view method.
I want to be able to, at the very least, log the view controllers that are in the view hierarchy that is being displayed. I would prefer to be able to get a handle to a specific view controller.
I know how to iterate the views, I just do not see how to access the view controllers of those views. I am looking for something that will give me the type of access to the view controllers that UINavigationController::ViewControllers does.
I thought I could get away with:
for (UIViewController* oVC in [self.view subviews])but this is not having the intended effect.
If someone has a way of doing this, please share it with me.
-isdi-
© Stack Overflow or respective owner