根据 iOS 和 iPadOS 16 Beta 3 发行说明:- 尝试在 \xc2\xa0 UIDevice \xc2\xa0via\xc2\xa0上设置方向setValue:forKey:\xc2\x80\x99 不受支持且不再有效。相反,他们说使用:preferredInterfaceOrientationForPresentation。
preferredInterfaceOrientationForPresentation就我而言,通过使用或 ,强制视图控制器方向在 iOS 16 beta 中不起作用requestGeometryUpdate。
以前,UIDevice.current.setValue(UIInterfaceOrientation.landscapeLeft.rawValue,\xc2\xa0forKey: "orientation")工作正常。