I am developing an application that has several views and a root view controller. It's based on UINavigationController using pushViewController: In didFinishLaunchingWithOptions:
BIDLoginController *loginController = [[BIDLoginController alloc] initWithNibName:@"Login" bundle:nil];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:loginController];
[self.window setRootViewController:self.navController];
In loginController:
BIDMainPageController *mainPageController = [[BIDMainPageController alloc] initWithNibName:@"MainPage" bundle:nil];
[self.navigationController pushViewController:mainPageController animated:YES];
but the view controllers are subclasses of UIViewController, not UINavigationController. Now I want some of the views to support orientation(portrait and landscape) and some of them only support portrait. I have tried the following:
- (BOOL)shouldAutorotate
{
return NO;
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait;
}
It doesn't work. shouldAutorotate: method never been called. I have tried UINavigationControllerDelegate with no result either. When I change these view controllers' super class from UIViewController to UINavigationController, the view doesn't show up, only a navigation bar is shown. Can anyone help with this?