【问题标题】:How to check the compass heading is pointing to a particular location or not?如何检查指南针航向是否指向特定位置?
【发布时间】:2012-08-03 10:39:53
【问题描述】:

我是 iphone 开发新手。我想知道是否有任何方法可以检查一个人 iphone 是否指向特定位置。我知道有 CLLocation 框架来获取设备的标题.但我也想检查它是否也指向正确的方向。目的地位置是通过经度和纬度获得的。有人可以给我一个方法吗?

提前致谢

【问题讨论】:

    标签: iphone gps xcode4.3


    【解决方案1】:

    CLLocationManager 会给你标题,在这里查看文档-> https://developer.apple.com/library/mac/ipad/#documentation/CoreLocation/Reference/CLLocationManager_Class/CLLocationManager/CLLocationManager.html

    另外,看看这个答案,他们谈论 CLLocationDirection 和 trueHeading -> https://stackoverflow.com/a/2043694/1104563

    --- 更新

    没有内置的方法可以做到这一点,您需要使用公式来确定这一点。公式可以在这里找到calculate bearing in relation to two points

    此外,您还可以查看这个 SO 答案: CLLocation Category for Calculating Bearing w/ Haversine function

    希望这会有所帮助。祝你好运!

    【讨论】:

    • 有没有办法识别 iphone 设备仅指向该位置?
    猜你喜欢
    • 1970-01-01
    • 2011-07-02
    • 2012-08-10
    • 1970-01-01
    • 1970-01-01
    • 2016-05-15
    • 1970-01-01
    • 2013-08-20
    • 1970-01-01
    相关资源
    最近更新 更多