Getting device orientation in Swift

后端 未结 13 1429
滥情空心
滥情空心 2020-11-28 23:23

I was wondering how I can get the current device orientation in Swift? I know there are examples for Objective-C, however I haven\'t been able to get it working in Swift.

13条回答
  •  遥遥无期
    2020-11-28 23:36

    To find current device orientation simply use this code:

    UIApplication.sharedApplication().statusBarOrientation

    for swift 3.0

    UIApplication.shared.statusBarOrientation

提交回复
热议问题