有关iPhone 6和iPhone 6 Plus屏幕尺寸的文章很多,也有问题问。本文提供了很好的解释。
但是,在模拟器中测试我的应用程序时我很困惑。我在中有以下代码AppDelegate
。
- (BOOL) application: (UIApplication *) application didFinishLaunchingWithOptions: (NSDictionary *) launchOptions
{
UIScreen *screen = [UIScreen mainScreen];
NSLog(@"Screen width %.0f px, height %.0f px, scale %.1fx",
(double) screen.bounds.size.width,
(double) screen.bounds.size.height,
(double) screen.scale);
return YES;
}
我从各种设备的iOS模拟器中得到以下结果:
iPhone 4S: Screen width 320 px, height 480 px, scale 2.0x
iphone 5: Screen width 320 px, height 568 px, scale 2.0x
iPhone 5S: Screen width 320 px, height 568 px, scale 2.0x
iPhone 6: Screen width 320 px, height 568 px, scale 2.0x
iPhone 6 Plus: Screen width 320 px, height 568 px, scale 2.0x
对于iPhone 4S,iPhone 5和iPhone 5S,结果都不错。但是,我希望iPhone 6和iPhone 6 Plus的屏幕更大,并且我希望iPhone 6 Plus的屏幕为3.0。怎么了?
感谢您的解释。
似乎您没有为应用程序提供正确的启动图像。如果未设置正确的启动图像,则该应用程序将像在iPhone 5 / 5S上一样运行,这就是为什么您在登录时会得到这些令人困惑的结果的原因。iPhone 6屏幕尺寸为375x667像素比例x2,iPhone 6+ 414x736像素比例x3。因此,如果您要为iPhone 6设置启动图像,则其尺寸应分别为750x1334像素和iPhone 6+的1242x2208。祝好运!
编辑:
正如rmaddy在评论中提到的那样,最好使用具有适当布局约束的启动屏幕故事板来适合所有屏幕,而不是为所有屏幕都提供一堆图像(这也会增加应用程序的大小)。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句