【发布时间】:2018-09-14 15:37:29
【问题描述】:
我对 swift 4.2 中的 faceUp、faceDown 和landScape 方向感到好奇,以前有帮助方法来检查 faceUp、faceDown 的横向方向。任何人都知道这个辅助函数的替代方法。提前致谢。
UIDeviceOrientationIsLandscape(orientation)
【问题讨论】:
我对 swift 4.2 中的 faceUp、faceDown 和landScape 方向感到好奇,以前有帮助方法来检查 faceUp、faceDown 的横向方向。任何人都知道这个辅助函数的替代方法。提前致谢。
UIDeviceOrientationIsLandscape(orientation)
【问题讨论】:
我修复了我使用状态栏方向的问题。
if UIApplication.shared.statusBarOrientation == .landscapeLeft || UIApplication.shared.statusBarOrientation == .landscapeRight || UIApplication.shared.statusBarOrientation.isLandscape { return true}
所以如果你使用UIDeviceOrientationIsLandscape这个函数你可以用上面的代码替换它。
【讨论】:
我已经进行了一些搜索和替换:
UIDeviceOrientationIsLandscape(orientation)
是
UIDevice.current.orientation.isLandscape
【讨论】: