Ios 检测到iPhone 6和6+;身高568分?

Ios 检测到iPhone 6和6+;身高568分?,ios,iphone,Ios,Iphone,我正在维护一个在iphone6和iphone6plus发布之前开发的应用程序。应用程序的开发人员使用代码在屏幕上放置元素。他们根据屏幕高度的不同点检测放置视图的屏幕高度。作为应用程序的维护者,我需要确保该应用程序在最新版本的iPhone上运行良好。该应用程序在iPhone 6和6+上运行良好,未经修改,返回的屏幕高度为568。应用程序在实际设备上是否运行良好,还是模拟器出现错误?您可能无法通过应用商店获得应用程序。问题是该应用程序实际上并不“运行良好”;iPhone6和iPhone6Plus将其

我正在维护一个在iphone6和iphone6plus发布之前开发的应用程序。应用程序的开发人员使用代码在屏幕上放置元素。他们根据屏幕高度的不同点检测放置视图的屏幕高度。作为应用程序的维护者,我需要确保该应用程序在最新版本的iPhone上运行良好。该应用程序在iPhone 6和6+上运行良好,未经修改,返回的屏幕高度为568。应用程序在实际设备上是否运行良好,还是模拟器出现错误?

您可能无法通过应用商店获得应用程序。问题是该应用程序实际上并不“运行良好”;iPhone6和iPhone6Plus将其视为iPhone5应用程序,并以“缩放”模式显示。苹果可能不会在新提交的版本中接受这一点。如果你给这个项目一个启动屏幕,它将成为一个“原生”的iPhone6和iPhone6Plus应用程序,然后你将看到故事的真实内容。

马特是对的。我在实用程序类中编写了一个用于确定屏幕大小的小方法。注释告诉您每个设备的日志中应该返回什么。除了iphone6plus外,所有手机的屏幕大小和报告大小都相同

+ (NSInteger)deviceType {
    CGSize screenSize = [[UIScreen mainScreen] bounds].size;
    CGFloat deviceScale = [UIScreen mainScreen].scale;
    LFDeviceType device = LFDeviceTypePhoneClassic;

    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
        device = LFDeviceTypePhoneClassic; // Just in case it doesn't make it through the conditionals
        // Classic has a resolution of 480 × 320
        if( (screenSize.height == 480 || screenSize.width == 480) && deviceScale == 1.0f ) {
            device = LFDeviceTypePhoneClassic;
        // Retina has a resolution of 960 × 640
        } else if( (screenSize.height == 480 || screenSize.width == 480) && deviceScale == 2.0f ) {
            device = LFDeviceTypePhoneRetina3_5;
        // Retina 4" has a resolution of 1136 x 640
        } else if (screenSize.height == 568 || screenSize.width == 568 ) {
            device = LFDeviceTypePhoneRetina4;
        // iPhone 6 has a resolution of 1334 by 750
        } else if (screenSize.height == 667 || screenSize.width == 667 ) {
            device = LFDeviceTypePhone6;
        // iPhone 6 Plus has an actual size of 2208 × 1242 and resolution of 1920 by 1080
        // Reported size is 736 x 414 @3x
        } else if (screenSize.height == 736 || screenSize.width == 736 ) {
            device = LFDeviceTypePhone6Plus;
        }

    } else if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
        device = LFDeviceTypePadClassic; // Just in case it doesn't make it through the conditionals
        if(deviceScale == 1.0f) {
            device = LFDeviceTypePadClassic;
        } else if (deviceScale == 2.0f) {
            device = LFDeviceTypePadRetina;
        }
    }
    //NSLog(@"The device is %@ scale is %f and the height is %f and width is %f", device, deviceScale, screenSize.height, screenSize.width);

    return device;
}

当前你的应用程序正在缩放模式下工作,如果你为6和6+添加启动屏幕,那么你的应用程序将处于实际大小,在包含6和6+的启动屏幕后,你将获得实际屏幕大小。

我已经使用iPhone 6和6+分辨率为应用程序设计了一个新的启动屏幕。我能做的就是用iPhone 6+的分辨率替换iPhone 5的图形。对不起,你只是剽窃了我的答案而已。@matt sry brow没有检查你的答案