【问题标题】:[UIScreen mainScreen].bounds.size differences between iOS 7 and iOS 8[UIScreen mainScreen].bounds.size iOS 7 和 iOS 8 的区别
【发布时间】:2014-11-17 09:30:26
【问题描述】:

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' 变量,将较短的分配给 '高度'变量)?我应该补充一点,我正在以编程方式创建视图。

【问题讨论】:

  • 我遇到了这个问题,你正在翻转宽度和高度值以进行旋转,听起来它在 iOS 8 中变得更简单,但最好检查 iOS 版本,如果它是

标签: ios cocoa-touch ios7 ios8


【解决方案1】:

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

【讨论】:

  • 谢谢。我认为与其检测版本,不如计算哪个更大,然后将宽度分配给两个值中的较大者。
猜你喜欢
  • 1970-01-01
  • 2017-01-25
  • 2015-01-02
  • 2015-01-07
  • 1970-01-01
  • 2014-07-31
  • 1970-01-01
  • 2015-05-27
  • 2015-10-15
相关资源
最近更新 更多