iPhone 4 屏幕尺寸不正确?
有人能告诉我为什么以下代码会在 iPhone 4 上返回 Screen Size: 320.000000, 480.000000
吗?
CGRect screenRect = [[UIScreen mainScreen] bounds];
NSLog(@"Screen Size: %f, %f", screenRect.size.width, screenRect.size.height);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该方法返回以点为单位的大小,而不是像素。如果您是注册的苹果开发人员,我建议您观看有关 Retina 显示屏设计的 WWDC(新)视频。它有大量真正有用的信息。
UIKit 使用点,而 OpenGL 使用像素。 UIViews 现在有一个 contentScaleFactor 属性,在 iPhone 4 上为 2,到目前为止在其他所有设备上为 1...
That method returns a size in Points, not Pixels. If you are a registered apple developer, I would suggest watching the WWDC (new) video on designing for the Retina display. It has a load of really useful information.
UIKit uses points, however OpenGL uses pixels. UIViews now have a contentScaleFactor property, which will be 2 on iPhone 4, and 1 on everything else so far...