iPhone 4 屏幕尺寸不正确?

发布于 2024-09-07 16:55:54 字数 245 浏览 2 评论 0 原文

有人能告诉我为什么以下代码会在 iPhone 4 上返回 Screen Size: 320.000000, 480.000000 吗?

 CGRect screenRect = [[UIScreen mainScreen] bounds];
 NSLog(@"Screen Size: %f, %f", screenRect.size.width, screenRect.size.height);

Could someone tell me why the following code would return Screen Size: 320.000000, 480.000000 on the iPhone 4?

 CGRect screenRect = [[UIScreen mainScreen] bounds];
 NSLog(@"Screen Size: %f, %f", screenRect.size.width, screenRect.size.height);

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

腻橙味 2024-09-14 16:56:00

该方法返回以点为单位的大小,而不是像素。如果您是注册的苹果开发人员,我建议您观看有关 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...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文