How to get current orientation of device programmatically in iOS 6?

前端 未结 8 744
庸人自扰
庸人自扰 2020-12-30 23:50

I have developed an iOS App and tested it on iOS6 device. While testing, I realized that my App is not responding to Orientation changes as expected.

Here is my Code

8条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-31 00:31

    You can try this, may help you out:

    How to change the device orientation programmatically in iOS 6

    OR

    Objective-c:

    UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation]
    

    Swift:

    if UIDevice.current.orientation.isLandscape {
        // Landscape mode
    } else {
        // Portrait mode
    }
    

提交回复
热议问题