【问题标题】:support all orientations xcode支持所有方向xcode
【发布时间】:2012-12-03 12:56:47
【问题描述】:

我以编程方式创建了所有视图,IB 没有。我的视图包含导航控制器、表格视图、按钮、标签栏。现在我应该如何让我的应用程序支持 iOS 5 和 iOS 6 的所有方向。

【问题讨论】:

标签: objective-c ios xcode orientation


【解决方案1】:

把这个写在你所有的UIViewController-s:

- (NSInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskAll;
}
- (BOOL)shouldAutorotate {
    return YES;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
    return YES;
}

【讨论】:

    【解决方案2】:

    您是否尝试在项目目标的摘要窗格中设置支持的设备方向,如附图所示?

    【讨论】:

      【解决方案3】:

      这已在 iOS 6 中更改:

      - (NSInteger)supportedInterfaceOrientations
      {
          return UIInterfaceOrientationMaskAll;
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2011-12-09
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多