为什么self.view.frame.size.width在模拟器上没有变化? [英] Why doesn't self.view.frame.size.width change on the simulator?

查看:162
本文介绍了为什么self.view.frame.size.width在模拟器上没有变化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将此语句添加到ViewDidLoad:

I added this statement to ViewDidLoad:

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

这是我在模拟器的Device属性为iPhone时得到的结果:

Here's the result I get when the "Device" property of the simulator is "iPhone":


屏幕分辨率:(320.000000,548.000000)

Screen resolution: (320.000000, 548.000000)

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

Same thing when I set it to "iPhone (Retina 4-inch)":


屏幕分辨率:(320.000000,548.000000)

Screen resolution: (320.000000, 548.000000)

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

But why? Isn't the screen resolution supposed to be different?

推荐答案

这是因为分辨率以点而非像素打印

This is because the resolution is printed in points and not in pixels

对于视网膜显示 1点= 2像素

对于常规显示 1点= 1像素

这篇关于为什么self.view.frame.size.width在模拟器上没有变化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆