SplitViewController旋转iOS8无法按预期工作

SplitViewController旋转iOS8无法按预期工作

本文介绍了UISplitViewController旋转iOS8无法按预期工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我创建一个新的基于UISplitViewController的项目并向详细viewController添加几个容器视图,我可以为容器视图正确地进行旋转,并且它可以在没有任何代码实现旋转的情况下执行此操作,它似乎只是工作了这个包可以说,这真的很棒。谁能解释为什么这有效?但是当我在没有适当的iOS 8旋转方法的现有应用程序上尝试它时它根本不会旋转?

If I create a new UISplitViewController based project and add a couple of container views to the detail viewController, I can get rotation working properly for the container views and it does this without any code implementing rotation, it just seems to work out of the bag so to speak, which is really great. Can anyone explain why this works? but when I try it on an existing app without appropriate iOS 8 rotation methods it doesn't rotate at all?

推荐答案

不确定如果这是你的问题,但很可能就是这样。

Not sure if this is your issue, but could well be it.

iOS8和旧的xcode项目存在一个常见问题,即运行时不会改变方向。只影响iOS8。

There is a common problem with iOS8 and older xcode projects not changing orientation when run. Only affects iOS8.

这似乎是由于旧的xcodes用于生成的剩余代码行,而最新的xcode没有检测到或警告你。

This seems to be due to a leftover line of code older xcodes used to generate and the latest xcode does not detect or warn you about.

违规行将在您的AppDelegate didFinishLaunchingWithOptions 函数中,如下所示:

The offending line will be in your AppDelegate didFinishLaunchingWithOptions function and looks like the following:

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

如果它在那里注释,旋转应该开始工作。

Comment this out if it is there and rotation should start working.

这篇关于UISplitViewController旋转iOS8无法按预期工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 07:43