Contents

prefersInterfaceOrientationLocked

A Boolean value that indicates whether the view controller prefers to lock the scene’s interface orientation when the scene is visible.

Declaration

var prefersInterfaceOrientationLocked: Bool { get }

Discussion

The default is false. Set this property to true to indicate the view controller’s preference to lock the scene’s interface orientation. Check UIWindowScene.effectiveGeometry.isInterfaceOrientationLocked for the current state of the interface orientation lock. The system will consider locking the interface orientation when these conditions are true:

  • The scene is centered on the screen

  • The scene is the same size as the screen

  • The scene is not occluded by another scene

The system continuously monitors the state and when the app no longer satisfies the requirements, it disables the interface orientation lock.

If you change the value of prefersInterfaceOrientationLocked, call setNeedsUpdateOfPrefersInterfaceOrientationLocked().

See Also

Configuring the view rotation settings