我已经开发了颤振和我有一个在设备旋转的问题。
例如,当用户单击按钮时,它会产生旋转设备。(以下代码)
SystemChrome.setPreferredOrientations(
_isPortrait
? [
DeviceOrientation.landscapeRight,
]
: [
DeviceOrientation.portraitUp,
],
)旋转结束后,我将改变旋转景观+纵向(直接旋转用户设备)。
所以我用了下面的代码。
SystemChrome.setPreferredOrientations(
_isPortrait
? [
DeviceOrientation.landscapeRight,
]
: [
DeviceOrientation.portraitUp,
],
).then((value) {
SystemChrome.setPreferredOrientations([]);
});它在iOS16下工作。
但是在iOS16中,它不起作用。(改变旋转后,它是用动画回滚原点旋转)
谁知道这个问题?
谢谢。
发布于 2022-09-15 06:40:03
以前苹果在UIDevice.current.setValue(value, forKey: "orientation") 16之后使用iOS来设置定位,由于一些bug,上述方法被废弃了,而不是推荐我们使用windowScene.requestGeometryUpdate(.iOS(interfaceOrientations: orientation))这种方法。供进一步参考,https://developer.apple.com/forums/thread/707735?answerId=726322022#726322022
https://stackoverflow.com/questions/73724575
复制相似问题