主要故事板设置影响iOS8中的旋转功能
问题描述:
在我的应用程序中,旋转在iOS7中正常工作,但在iOS8中不起作用。主要故事板设置影响iOS8中的旋转功能
正如你所看到的,在状态栏旋转,但视图控制器不。
我发现问题是由主故事板设置引起的,但我不知道为什么它引起了这个问题。我刚刚删除了项目文件中的主要故事板设置,并且在iOS8中一切正常。
以下是我的代码加载故事板。
[self setMainStoryboard:[UIStoryboard storyboardWithName:@"MainStoryboard-ipad" bundle:nil]];
UIViewController *vc = [mainStoryboard instantiateInitialViewController];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
[self.window setRootViewController:vc];
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
也许我用错误的方式加载故事板?
答
我解决了这个问题,但我认为这可能不是一个好的解决方案。这只是一个解决方法。无论如何,这是我所做的。如果遇到同样的问题,您可以尝试删除目标中的主要故事板设置。
就是这样,没有进一步的步骤。我删除主要故事板设置后,一切正常。也许我加载主要故事板的方式不正确,或者我的故事板设置有问题。
以下是我用故事板加载代码:
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Storyboard" bundle:nil];
UIViewController *vc = [storyboard instantiateInitialViewController];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];
// Override point for customization after application launch.
[self.window setRootViewController:nav];
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
如果有人知道正确的使用方法主要情节串连图板,请给我一些反馈。谢谢!