I would like to know why tha't happening: I have 2 view controllers embeded in navigation controller. All have superclass where I have something like that:
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
NSLog(@"Visible VC: %@",self.navigationController.visibleViewController.class);
}
So far everything works like a charm. Then I added third navigation controller which is the modal view controller. It also has super class like the others. Now I see strange thing. After click button to present modal View controller I see log: "Visible: (null)", but it's ok because third VC is not in navigation controller. When i click dismiss button to hide modal View controller I see 2 logs: "Visible: (null) Visible: ViewController3". My question is: Why visible view controller is not kind of class ViewController2 ? It should be, because third one was dismissed. How can i resolve it ? I need to have visible view controller kind of class View Controller 2.