【发布时间】: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