读书人

Apple内部对MKUserLocation除去偏移的

发布时间: 2012-06-30 17:20:12 作者: rapoo

Apple内部对MKUserLocation去除偏移的方法。

找到Apple内部对MKUserLocation去除偏移的方法。?

[MKLocationManager _applyChinaLocationShift:(CLLocation*)arg]?

这个方法返回去除偏移后的CLLocation*。?


Code:?


@interface?MKLocationManager?
- (CLLocation*)_applyChinaLocationShift:(CLLocation*)arg;?
- (BOOL)chinaShiftEnabled;?
+ (id)sharedLocationManager;?
@end?

CLLocationManager's Delegate:?

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation?
{?
if ([[MKLocationManager sharedLocationManager] chinaShiftEnabled]) {?
newLocation = [[MKLocationManager sharedLocationManager] _applyChinaLocationShift:newLocation];?
if (newLocation == nil) return;?
}?
}

读书人网 >移动开发

热点推荐