UIScreen 边界与 applicationFrame

发布于 2024-09-07 05:37:34 字数 276 浏览 9 评论 0原文

为什么我在 Apple 的一些示例代码(例如 PhotoScroller)中看到我应该在 loadView: 中执行以下操作,

CGRect frame = [[UIScreen mainScreen] bounds]; 

而不是

CGRect frame = [[UIScreen mainScreen] applicationFrame]; 

获取主屏幕的框架是否有区别?

Why do I see in some sample code from Apple (such as PhotoScroller) that I should do the following in loadView:

CGRect frame = [[UIScreen mainScreen] bounds]; 

instead of

CGRect frame = [[UIScreen mainScreen] applicationFrame]; 

Does it make a difference to get the main screen's frame?

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

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

发布评论

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

评论(2

没︽人懂的悲伤 2024-09-14 05:37:34

ApplicationFrame 是屏幕尺寸减去状态栏的尺寸(如果可见),bounds 是屏幕尺寸,与状态栏无关。

因此,假设您的应用将状态栏设置为可见,applicationFrame 将返回 CGRectMake(0,0,320,460),而在相同条件下,bounds 将返回 CGRectMake(0,0,320,480) 。这些数字假定 iPhone/iPod Touch 屏幕尺寸。

UIScreen 类参考

ApplicationFrame is the screen size minus the size of the status bar (if visible), bounds is the screen size regardless of status bar.

So applicationFrame would return CGRectMake(0,0,320,460) assuming your app has the status bar set to be visible, while bounds would return CGRectMake(0,0,320,480) under the same conditions. Those numbers are assuming iPhone/iPod Touch screen sizes.

UIScreen Class Reference

浅暮の光 2024-09-14 05:37:34

iOS 9 更新

在 iPad 上使用分割视图功能时,applicationFrame 返回应用程序窗口的大小。 bounds 始终返回设备的大小。

iOS 9 Update

When using the Split View feature on the iPad, applicationFrame returns the size of your app window. bounds always returns the size of the device.

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