CLLocationManager和iPhone中的标题度

CLLocationManager和iPhone中的标题度

本文介绍了CLLocationManager和iPhone中的标题度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用CLLocationManager对象的didUpdateHeading事件,如何将生成的heading.x和heading.y值转换为可以绘制到指南针图像的度数?

Using the CLLocationManager object's didUpdateHeading event, how do I convert the resulting heading.x and heading.y values into degrees I can plot onto an image of a compass?

推荐答案

对于标题学位,您可以使用属性而不是 x y

For headings degrees you can use magneticHeading and trueHeading properties instead of x and y.

相对于真北的航向(以度为单位)。 (只读)

The heading (measured in degrees) relative to true North. (read-only)

@property(readonly, nonatomic) CLLocationDirection trueHeading

讨论

此属性中的值表示指向地理北极的标题。无论设备的物理或接口方向如何,此属性中的值始终相对于设备顶部进行报告。值0表示真北,90表示到期东,180表示到期南,依此类推。负值表示无法确定标题。

The value in this property represents the heading that points toward the geographic North Pole. The value in this property is always reported relative to the top of the device, regardless of the device’s physical or interface orientation. The value 0 represents true North, 90 represents due East, 180 represents due South, and so on. A negative value indicates that the heading could not be determined.

这篇关于CLLocationManager和iPhone中的标题度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 09:11