Cim*_*man 20 objective-c ios ios-simulator iphone-6 iphone-6-plus
有很多文章和有关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;
}
Run Code Online (Sandbox Code Playgroud)
我从各种设备的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.怎么了?
谢谢你的解释.
Fah*_*mov 32
您似乎未向应用提供正确的启动图像.当没有正确的启动图像设置时,应用程序将像iPhone 5/5S一样运行,这就是为什么在记录时遇到这些令人困惑的结果的原因.iPhone 6屏幕尺寸为375x667像素刻度x2,iPhone 6 + 414x736像素刻度x3.因此,如果你想为iPhone 6设置启动图像,它应该分别为750x1334像素大小和1242x2208分别用于iPhone 6+.祝好运!
编辑:
正如rmaddy在评论中提到的,最好使用具有适当布局约束的启动画面故事板来适应所有屏幕,而不是为所有屏幕提供大量图像(这也会增加应用程序大小).
您必须在适用于iPhone 6和6+的Imageasset中添加启动图像并获得适当的分辨率.
如果您不知道分辨率请检查右侧导航器>选择第3个选项.现在在屏幕截图中你可以看到Expected size 1242x2208 pixel
请查看附带的截图.一旦你添加了所有图像,那么只有你才能得到适当的.
对于iPhone 6,它将记录
屏幕宽度375像素,高度667像素,比例2.0倍
6+
屏幕宽度414像素,高度736像素,比例3.0倍

| 归档时间: |
|
| 查看次数: |
33455 次 |
| 最近记录: |