0

我将此语句添加到 ViewDidLoad:

NSLog(@"Screen resolution: (%f, %f)", self.view.frame.size.width, self.view.frame.size.height);

这是模拟器的“设备”属性为“iPhone”时得到的结果:

屏幕分辨率:(320.000000、548.000000)

当我将其设置为“iPhone(Retina 4 英寸)”时也是如此:

屏幕分辨率:(320.000000、548.000000)

但为什么?屏幕分辨率不应该不同吗?

4

2 回答 2

2

这是因为分辨率是以点而不是以像素为单位打印的

用于视网膜显示器1 point = 2 pixels

对于常规显示1 point = 1 pixel

于 2013-07-16T10:40:41.567 回答
0

您应该使用UIScreen来检查屏幕分辨率:

[[UIScreen mainScreen] bounds].size.height
[[UIScreen mainScreen] bounds].size.weight

正如这里的其他答案提到的分辨率是用点而不是像素来衡量的。

于 2013-07-16T10:41:43.540 回答