gpt4 book ai didi

ios - 如果我改变握持设备的方式,CLHeading magneticHeading 将给出不同的值

转载 作者:搜寻专家 更新时间:2023-10-31 22:21:33 25 4
gpt4 key购买 nike

我正在使用 CLHeading 的 magneticHeading 来获取设备的航向方向,它非常准确。

如果我改变设备的方向(屏幕面向 x、y 或 z 轴),那么 magneticHeading 的值将改变 ~ +- 15 度。有没有办法解决这个问题?

最佳答案

我承认我不是专家,但我怀疑 documentation for CLHeading会给你指明正确的方向(双关语不是故意的)......

The value in this property represents the heading relative to the magnetic North Pole, which is different from the geographic North Pole. The value 0 means the device is pointed toward magnetic north, 90 means it is pointed east, 180 means it is pointed south, and so on. The value in this property should always be valid.

In iOS 3.x and earlier, the value in this property is always measured relative to the top of the device in a portrait orientation, regardless of the device’s actual physical or interface orientation. In iOS 4.0 and later, the value is measured relative to the heading orientation specified by the location manager. For more information, see the headingOrientation property in CLLocationManager Class Reference.

看来您需要检测设备方向并相应地调整值。

关于ios - 如果我改变握持设备的方式,CLHeading magneticHeading 将给出不同的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34553281/

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