I'm using a ViewController @interface PagerViewController : UIViewController <UIScrollViewDelegate>
where I add other ViewControllers as a child ( addChildViewController
) Those ViewControllers that I add are from difference classes but they all inherit from UIViewController. I can loop thru them using this code:
for(NSUInteger i = 0; i<(unsigned int)[_app.windows count]; i++) {
NSLog(@"%@",((MyViewController*)[self.childViewControllers objectAtIndex:i]).getQAnswer);
}
However, I always need to cast it to the correct one (in the above example I cast it to MyViewController. The problem is that there are many childs from different classes on it, so what if I only want the childs from the class "anotherViewController" instead of "MyViewController"?