【问题标题】:ios: add compass to ARViewios:将指南针添加到 ARView
【发布时间】:2012-11-15 07:06:53
【问题描述】:

我想在以下项目中为 ARView 添加一个指南针:http://developer.apple.com/library/ios/#samplecode/pARk/Listings/pARk_ARView_m.html#//apple_ref/doc/uid/DTS40011083-pARk_ARView_m-DontLinkElementID_5

我用- (void) locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading

但它似乎没有被执行。 请帮我解决这个问题。 提前致谢

【问题讨论】:

    标签: objective-c ios orientation augmented-reality compass-geolocation


    【解决方案1】:

    请参阅Location Awareness Programming Guide 的以下引用。此外,您可能需要在Settings 应用程序中检查您的位置配置(在 iOS 6 中的“隐私”下),以确保您的应用程序已获得位置操作授权。

    根据指南:

    接收航向事件的步骤如下:

    1. 创建一个CLLocationManager 对象。
    2. 通过调用headingAvailable 类方法确定航向事件是否可用。 (在 iOS 3.x 及更早版本中,请改为检查 headingAvailable 属性的值。)
    3. delegate 分配给位置管理器对象。
    4. 如果您想要真北值,请启动定位服务。
    5. 调用startUpdatingHeading 方法开始传递航向事件。

    【讨论】:

      猜你喜欢
      • 2012-02-02
      • 2012-08-20
      • 2012-09-12
      • 1970-01-01
      • 1970-01-01
      • 2012-10-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多