UISplitViewController 旋转 iOS8 没有按预期工作

UISplitViewController rotation iOS8 not working as expected(UISplitViewController 旋转 iOS8 没有按预期工作)

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

问题描述

如果我创建一个新的基于 UISplitViewController 的项目并将几个容器视图添加到详细视图控制器,我可以使容器视图的旋转正常工作,并且它在没有任何代码实现旋转的情况下做到这一点,它似乎可以解决这个包可以这么说,真的很棒.谁能解释为什么这有效?但是当我在没有适当 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.

这似乎是由于旧的 xcode 用于生成的剩余代码行,而最新的 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 没有按预期工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:UISplitViewController 旋转 iOS8 没有按预期工作

基础教程推荐