gpt4 book ai didi

iphone - iOS6和iOS7之间UIScreenbounds和applicationFrame的区别

转载 作者:行者123 更新时间:2023-12-03 19:51:21 24 4
gpt4 key购买 nike

使用iPhone4s iOS7,屏幕方向为横向

-使用以下 SDK 构建应用程序

我使用iOS6 SDK和iOS7 SDK构建了应用程序,并检查了每个屏幕分辨率。下面显示了结果:

iOS6 SDK:

[[UIScreen mainScreen] bounds]           == (0, 0, 320, 480)
[[UIScreen mainScreen] applicationFrame] == (0, 0, 300, 480)

iOS7 SDK:

[[UIScreen mainScreen] bounds]           == (0, 0, 300, 480)
[[UIScreen mainScreen] applicationFrame] == (0, 0, 320, 480)

为什么我们在 iOS7 中得到反转值?

最佳答案

是的。在 iOS6 及更低版本中,状态栏不包含在 View 中。但在iOS7中,状态栏包含在主视图中。如果您使用导航 Controller ,那么您可以通过设置导航栏的 Translucent 和 Opaque 属性来获得 iOS6 行为。

[self.navigationController.navigationBar setOpaque:YES];
[self.navigationController.navigationBar setTranslucent:NO];

同样,iOS7 中标签栏默认也是半透明的。您可以通过设置这些属性将它们设置为不透明。

[self.tabBarController.tabBar setOpaque:YES];
[self.tabBarController.tabBar setTranslucent:NO];

关于iphone - iOS6和iOS7之间UIScreenbounds和applicationFrame的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19809176/

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