我正在开发一个应用程序,我将rootViewController设置为
if(token){
UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
UIViewController* viewController = [sb instantiateViewControllerWithIdentifier:@"Home"];
UINavigationController *navigationController = [[UINavigationController alloc]
initWithRootViewController:viewController];
[navigationController setNavigationBarHidden:YES animated:NO];
self.window = [[UIWindow alloc]
initWithFrame:[[UIScreen mainScreen] bounds]];
[self.window makeKeyAndVisible];
[self.window setRootViewController:navigationController];
}
当这段代码工作时方向无法正常工作时,状态栏会旋转但视图保持不变。
这在iOS7.1及更低版本中运行良好,但是当它在iOS8.1上运行时,我们就会遇到这个问题。