iOS不会旋转

Ech*_*lon 2 iphone uiinterfaceorientation ios auto-rotation

我正在尝试为我的应用添加自动旋转,但有困难.我可以调整所有内容(TableView和一些标签),但状态栏和我的窗口的其余部分(例如:标签栏和导航控制器)仍然是纵向.我有一个从窗口到顶部ViewController的三个视图heirarchy,我将所有内容shouldAutorotateToInterfaceOrientation设置为YES,除了Summary在目标属性的部分中选择了倒置,但它拒绝让步.这种情况发生在模拟器和iPhone 4上.在XCode 4上都是4.3.我已经在视图方向上搜索了苹果文档,但是我还需要设置其他地方吗?

在我Info.plist,我有以下内容:

<key>UISupportedInterfaceOrientations</key>
<array>
    <string>UIInterfaceOrientationPortrait</string>
    <string>UIInterfaceOrientationLandscapeLeft</string>
    <string>UIInterfaceOrientationLandscapeRight</string>
</array>
Run Code Online (Sandbox Code Playgroud)

Ech*_*lon 5

我最终发现,如果你有一个UITabBarController,所有的选项卡视图都需要支持旋转.应该通过记住来节省一些时间:

  • 没有什么会旋转,直到所有的选项卡中的UITabBarController支持旋转
  • 如果您尝试在视图旋转时手动调整大小,则可以更轻松地在笔尖中的每个控件上设置大小调整属性.设置锚定位置和伸展规则,大多数事情似乎都"正常工作".
  • 分段控件似乎需要在- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration方法中手动调整大小