【发布时间】:2026-01-31 03:00:01
【问题描述】:
我正在开发适用于 iphone4 和 iPhone 5 的应用程序。我正在使用以下代码来获取屏幕尺寸
CGRect screenBounds = [[UIScreen mainScreen] bounds];
我使用的是 iPhone 5 模拟器,但它显示的是 iPhone 4 的屏幕尺寸。
【问题讨论】:
-
你确定吗,我刚刚检查过它并没有显示相同的大小。 4" 视网膜:
(CGRect) screenBounds = origin=(x=0, y=0) size=(width=320, height=568)3,5" 视网膜(CGRect) screenBounds = origin=(x=0, y=0) size=(width=320, height=480) -
@rckoenes:: 我已经发布了图片
-
看大力水手的回答,你错过了
Default-568h@2x.png。阅读 Apple 文档,它会告诉您需要Default-568h@2x.png才能在 4" 设备上以全屏模式运行。 -
@rckoenes:: 好的,我会试试的
-
是的,就像大力水手的回答所说,您将需要
Default-568h@2x.png启动图像。另请阅读Apple documentation
标签: iphone objective-c ios