【问题标题】:ipad 2 compass?ipad 2 指南针?
【发布时间】:2011-10-01 20:31:22
【问题描述】:

我需要知道 iPad 2 是否有内置指南针并且仍然响应:

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

iPhone 的确切方式。有什么我应该知道的差异吗?

谁能帮帮我?我只在很短的时间内接触了 iPad,并且没有收到此方法的回调。该应用在 iPhone 3GS/4 上运行良好

谢谢!

=============

我的代码如下所示:

- (void)accelerometer:(UIAccelerometer *)meter didAccelerate:(UIAcceleration *)acceleration {

switch (currentOrientation) {
    case UIDeviceOrientationLandscapeLeft:
        self.viewAngle = atan2(acceleration.x, acceleration.z);
        break;
    case UIDeviceOrientationLandscapeRight:
        self.viewAngle = atan2(-acceleration.x, acceleration.z);
        break;
    case UIDeviceOrientationPortrait:
        self.viewAngle = atan2(acceleration.y, acceleration.z);
        break;
    case UIDeviceOrientationPortraitUpsideDown:
        self.viewAngle = atan2(-acceleration.y, acceleration.z);
        break;  
    default:
        break;
}

[self updateCurrentCoordinate];

}

但我从 GPSReader 获得了我的航向

【问题讨论】:

  • 请注意,原来的 iPad 也有指南针。

标签: ios cocoa-touch ipad core-location


【解决方案1】:

iPad2 有 2 个版本:-
仅 WiFi 和 WiFi + 3G
http://www.apple.com/ipad/specs/

位置 仅限无线网络
* 无线网络
* 数字罗盘

Wifi+3G
* 无线网络
* 数字罗盘
* 辅助 GPS
* 蜂窝

如果你能说出你得到了什么,因为 iPad 没有相同的方法。我有同样的问题,当我深入内心时,它让我更加复杂。

您能否编写带有过滤因子和调整的 x、y 和 z 轴脚本?
你愿意分享你的 kFilteringFactor 吗?不完全知道该使用什么,但可能也有帮助。

【讨论】:

  • 这是一台 3G 的 iPad,我没有使用任何 kFilteringFactor。在上面查找 didAccelerate 方法
猜你喜欢
  • 1970-01-01
  • 2014-09-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-09-10
  • 1970-01-01
  • 2010-12-30
相关资源
最近更新 更多