【问题标题】:For first time my UIView always goes in Portrait mode...though i set to Landscape第一次我的 UIView 总是进入纵向模式......虽然我设置为横向
【发布时间】:2012-01-22 18:12:44
【问题描述】:

我已使用以下代码将我的 iPad 应用设置为横向模式..

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
        return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
    } else {
        if (interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) {
            return NO;
        }
        return YES;
    }
}

当我手动旋转模拟器时,它会进入横向模式,永远不会进入纵向模式。

就在启动期间,我的应用程序进入纵向模式。

如何仅检测横向模式或如何设置为仅横向模式???

我也尝试过 BuildSettings 但无法解决问题...

【问题讨论】:

    标签: iphone objective-c orientation uiinterfaceorientation device-orientation


    【解决方案1】:

    您很可能没有在项目 plist 文件中将纵向作为支持的界面方向删除。

    您可以(在较新版本的 Xcode 中)在项目的“Supporting Files”文件夹中找到它。

    请注意,iPhone 和 iPad 有单独的设置,因此您可以根据平台设置不同的界面。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-06-03
      • 1970-01-01
      • 2014-09-18
      • 1970-01-01
      • 2012-03-29
      • 2012-11-03
      相关资源
      最近更新 更多