gpt4 book ai didi

iPhone 4 屏幕尺寸不正确?

转载 作者:行者123 更新时间:2023-12-03 19:33:53 25 4
gpt4 key购买 nike

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

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

最佳答案

该方法返回的大小以点为单位,而不是像素。如果您是注册的苹果开发人员,我建议您观看有关 Retina 显示屏设计的 WWDC(新)视频。它包含大量真正有用的信息。

UIKit 使用点,而 OpenGL 使用像素。 UIViews 现在有 contentScaleFactor property ,在 iPhone 4 上为 2,到目前为止,在其他所有设备上为 1...

关于iPhone 4 屏幕尺寸不正确?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3125480/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com