Т
var orientationValue: Int?
if UIDevice.current.orientation == .landscapeLeft {
// Home button to the right.
orientationValue = UIInterfaceOrientation.landscapeLeft.rawValue
} else if UIDevice.current.orientation == .landscapeRight {
// Home button to the left.
orientationValue = UIInterfaceOrientation.landscapeRight.rawValue
}
UIDevice.current.setValue(orientationValue, forKey: "orientation”)
не совсем правильно работает - меняет, но наоборот, там где
landscapeLeft
- меняет вправо. Если меняешь меставми строчки - совсем не работает =)