【问题标题】:ios 8 Orientation Issueios 8 方向问题
【发布时间】:2014-11-28 17:19:48
【问题描述】:

我在 iOS7 中开发的应用程序具有基于设备的强制定向: iphone -> 肖像 Ipad -> 横向

在 iOS8 中,如果我在 ipad 上的应用程序以纵向模式启动,它将以横向模式显示应用程序,但结果是:

如何修复 iOS 8 的方向?

【问题讨论】:

    标签: ios ipad cocoa-touch uiinterfaceorientation


    【解决方案1】:

    我不确定我是否可以回答我自己的问题,但我已经使用

    解决了这个问题
    [self.window setFrame:[[UIScreen mainScreen] bounds]];
    

    (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 方法的末尾。

    【讨论】:

    • 您可以回答自己的问题,如果没有其他人提出更好的答案,您应该回答。谢谢!
    【解决方案2】:
    - (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
    
    
    
    if ([window.rootViewController isKindOfClass:[UINavigationController class] ]) {
    
        if ([[window.rootViewController presentedViewController]
             isKindOfClass:[SignatureViewController class]]) {
            return UIInterfaceOrientationLandscapeRight;
        }
    
        return UIInterfaceOrientationMaskPortrait;
    }
    
        return UIInterfaceOrientationMaskPortrait;
    

    }

    【讨论】:

      【解决方案3】:

      我的问题与正在减号的 UIWindows 框架有关。所以在 MyViewController -(NSUInteger)supportedInterfaceOrientations Method 中编写如下代码

      [[UIApplication sharedApplication] setStatusBarHidden:NO];
      
      [self.view setFrame:CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height)];
      
      [appDel.window setFrame:CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height)];
      

      试试这个。

      【讨论】:

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