UINavigationControllerDelegate methods that are not called when entering the view controller that do not support the current orientation.
I have a UINavigationController as the root view controller of my application (the initial view controller on my storyboard).
Let's say I click ViewController A with this for orientation:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
Therefore, we do not support landscape mode. Also, let me click another ViewController with the code:
@interface B : UIViewController <UINavigationControllerDelegate>
@end
@implementation B
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
}
- (void)viewDidLoad {
[super viewDidLoad];
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
UINavigationController *nc = (UINavigationController*)appDelegate.window.rootViewController;
nc.delegate = self;
}
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
}
- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
}
@end
Now, if I have my iPhone in portrait, and I press the view controller B over A, after some touch event, then touch the back button in the navigation bar, everything is fine and the delegate methods are called (I do some things there).
, B, , "", ! UINavigationController, , ? , - .
, AppDelegate MainView, .
?
- : git://github.com/malaba/NavBarTest.git
Master-Detail, , .
? :
iPhone ( Simulator) , .?