According to the iOS & iPadOS 16 Beta 3 Release Notes:- Attempting to set an orientation on UIDevice via setValue:forKey:
isn’t supported and no longer works. Instead, they say use: preferredInterfaceOrientationForPresentation.
In my case, force view controller orientation is not working in iOS 16 beta either by using preferredInterfaceOrientationForPresentation
or requestGeometryUpdate
.
Previously, UIDevice.current.setValue(UIInterfaceOrientation.landscapeLeft.rawValue, forKey: "orientation")
was working fine.
CodePudding user response:
I noticed my issue seems like resolved by calling method below:
[UIViewController setNeedsUpdateOfSupportedInterface
You may give it a try.
CodePudding user response:
setValue:forKey
is a method of old NSObject
(NSKeyValueCoding
). It's not official documented and supported by UIDevice
class. Using it is considering using a private api. Apple can terminate it anytime they want.