简体   繁体   English

如何在iPhone 6 / 6s Plus上保留纵向启动画面

[英]How to keep portrait launch screen on iPhone 6/6s Plus

I have a problem with ip6/6s plus about launch screen. 我有关于启动画面的ip6 / 6s plus的问题。

Description: 描述:

I've set portrait for Launch Screen.xib. 我为Launch Screen.xib设置了肖像。 When I rotate device iphone 5,6, the screens are running well. 当我旋转设备iphone 5,6时,屏幕运行良好。 However, I'm running on iphone 6 plus and rotate screen. 但是,我正在使用iphone 6 plus和旋转屏幕。 The Launch Screen is showing with landscape mode. 启动屏幕以横向模式显示。 Now,I want to keep portrait Launch screen when iPhone 6 plus rotate. 现在,我想在iPhone 6加上旋转时保持纵向启动画面。 在iPhone 5/6 / 6s上 在iphone 6 / 6s plus上

You will save my life. 你将拯救我的生命。 Thanks 谢谢

If you want to run your entire app in portrait mode only you can change these settings on your target. 如果您想以纵向模式运行整个应用程序,则只能在目标上更改这些设置。 Just use the check boxes to select which orientations you would like to support. 只需使用复选框选择您想要支持的方向。

ProjectName > General ProjectName>常规

在此输入图像描述

You can set the following method. 您可以设置以下方法。

#define IS_IPHONE                               (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)

#define SCREEN_WIDTH                            ([[UIScreen mainScreen] bounds].size.width)
#define SCREEN_HEIGHT                           ([[UIScreen mainScreen] bounds].size.height)
#define SCREEN_MAX_LENGTH                       (MAX(SCREEN_WIDTH, SCREEN_HEIGHT))
#define SCREEN_MIN_LENGTH                       (MIN(SCREEN_WIDTH, SCREEN_HEIGHT))

#define IPHONE4                                 (IS_IPHONE && SCREEN_MAX_LENGTH < 568.0)
#define IPHONE5                                 (IS_IPHONE && SCREEN_MAX_LENGTH == 568.0)
#define IPHONE6                                 (IS_IPHONE && SCREEN_MAX_LENGTH == 667.0)
#define IPHONE6PLUS                             (IS_IPHONE && SCREEN_MAX_LENGTH == 736.0)



-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
        if (IPHONE6 || IPHONE6PLUS) {
            return (interfaceOrientation == UIInterfaceOrientationPortrait);
        }
        return nil;
    }

Or you can use the one more method 或者您可以使用另一种方法

- (BOOL)shouldAutorotate {
    return NO;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM