gpt4 book ai didi

iphone - 屏幕旋转锁定时如何获取设备方向?

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:17:51 26 4
gpt4 key购买 nike

我使用通知来获取设备的方向。

[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[notificationCenter addObserver:self
selector:@selector(deviceOrientationDidChange)
name:UIDeviceOrientationDidChangeNotification
object:nil];

但是当设备的屏幕旋转被锁定时,不会调用选择器函数。有什么帮助吗?

最佳答案

您可以使用加速度计获取屏幕方向的值。参见 this .另见 this博客

关于iphone - 屏幕旋转锁定时如何获取设备方向?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13509257/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com