Search code examples
iosswiftorientation

How to programatically check if orientation is locked on iOS - Swift


Is there a way to programmatically check if the iPods orientation lock is enabled before a rotation happens?

For example, if a user was to click a button could we check if the orientation lock was on to alert them that it must be off before an action happens on the click.


Solution

  • As for now there's no way to detect if orientation is locked or not. You could just add what orientation you should support in your application and what the default orientation should be, but you can´t get the status for the "Portrait lock" in the device.