根据 iOS & iPadOS 16 Beta 3 的发布说明:尝试通过
在我的情况下,在 iOS 16 beta 中通过使用
以前,
setValue:forKey:
在 UIDevice 上设置方向不再受支持且已不起作用。相反,建议使用:preferredInterfaceOrientationForPresentation。在我的情况下,在 iOS 16 beta 中通过使用
preferredInterfaceOrientationForPresentation
或 requestGeometryUpdate
强制视图控制器方向也无效。以前,
UIDevice.current.setValue(UIInterfaceOrientation.landscapeLeft.rawValue, forKey: "orientation")
可以正常工作。