OGeek|极客世界-中国程序员成长平台

标题: ios - [UIScreen mainScreen].bounds.size iOS 7 和 iOS 8 的区别 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 11:52
标题: ios - [UIScreen mainScreen].bounds.size iOS 7 和 iOS 8 的区别

iOS 8 中的 UIScreen 现在是面向界面的 (Is [UIScreen mainScreen].bounds.size becoming orientation-dependent in iOS8?)。

我的应用仅在横向模式下运行 - 因此在 iOS 7 和 iOS 8 中,bounds.size.width 和 bounds.size.height 的值将被切换。为了支持 iOS 7 和 iOS 8,这是否意味着在我的代码中,我需要检测 iOS 的版本(或者例如将两个维度中较大的一个分配给我的 'width' 变量,将较短的分配给 '高度'变量)?我应该补充一点,我正在以编程方式创建 View 。



Best Answer-推荐答案


是的,您需要以编程方式检查操作系统版本并返回适当的值。这是一种检查方法:How can we programmatically detect which iOS version is device running on? .

关于ios - [UIScreen mainScreen].bounds.size iOS 7 和 iOS 8 的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25990631/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4