在你的NavigationController里面加几句话:
- (void)viewDidLoad
{
[super viewDidLoad];
self.delegate = self;
}
- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
UIViewController *vc = [[UIViewController alloc] init];
[self presentViewController:vc animated:NO completion:NULL];
[vc dismissViewControllerAnimated:NO completion:NULL];
}
详情见http://
stackoverflow.com/questions/15519486/presenting-navigation-controller-in-landscape-mode-is-not-working-ios-6-0主要是,你一直是在push和pop,rootViewController始终NavigationController。不旋转设备,不会引起auto rotate动作,只能用一些其他奇葩的方法了。
你要用presentViewController,改变了rootViewController,就不会有这些问题了。