mirror of
https://github.com/yattee/yattee.git
synced 2025-08-09 20:24:06 +00:00
Orientation improvements
This commit is contained in:
@@ -21,11 +21,16 @@ struct Orientation {
|
||||
static func lockOrientation(_ orientation: UIInterfaceOrientationMask, andRotateTo rotateOrientation: UIInterfaceOrientation? = nil) {
|
||||
lockOrientation(orientation)
|
||||
|
||||
guard !rotateOrientation.isNil else {
|
||||
guard let rotateOrientation = rotateOrientation else {
|
||||
return
|
||||
}
|
||||
|
||||
UIDevice.current.setValue(rotateOrientation!.rawValue, forKey: "orientation")
|
||||
let orientationString = rotateOrientation == .portrait ? "portrait" : rotateOrientation == .landscapeLeft ? "landscapeLeft" :
|
||||
rotateOrientation == .landscapeRight ? "landscapeRight" : rotateOrientation == .portraitUpsideDown ? "portraitUpsideDown" : "allButUpsideDown"
|
||||
|
||||
logger.info("rotating to \(orientationString)")
|
||||
|
||||
UIDevice.current.setValue(rotateOrientation.rawValue, forKey: "orientation")
|
||||
UINavigationController.attemptRotationToDeviceOrientation()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user