我正在维护一款在iPhone 6和iPhone 6 Plus发布之前开发的应用程序。应用程序的开发人员使用代码在屏幕上放置元素。他们根据屏幕高度的点检测屏幕高度。作为应用程序的维护者,我需要确保该应用程序在最新版本的iPhone上运行良好。该应用似乎在iPhone 6和6+上运行良好而无需修改,返回的屏幕高度为568.应用程序在实际设备上表现良好还是模拟器错误?
答案 0 :(得分:0)
您可能无法通过App Store获取该应用。问题是该应用不实际上"运作良好&#34 ;; iPhone 6和iPhone 6 Plus将它视为iPhone 5应用程序并将其显示在"缩放"模式。 Apple可能不会在新提交的版本中接受它。如果你给项目一个启动屏幕,它将成为一个原生的" iPhone 6和iPhone 6 Plus应用程序,然后您将看到故事的真实情况。
答案 1 :(得分:0)
+ (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;
}
答案 2 :(得分:0)
目前你的应用程序正在以缩放模式工作,如果你添加6和6+的启动画面,那么你的应用程序将是实际大小,在包含6和6+的启动画面后,你将获得实际的屏幕尺寸。