我已经使用地图有一段时间了,所以我了解显示用户位置所需的基础知识
map.showsUserLocation = YES; //also have the box checked in .xib
设置位置管理器
- (CLLocationManager *)locationManager {
if (locationManager != nil) {
return locationManager;
}
locationManager = [[CLLocationManager alloc] init];
[locationManager setDesiredAccuracy:kCLLocationAccuracyNearestTenMeters];
[locationManager setDelegate:self];
return locationManager;
}
我已经登录并看到我正在点击 didUpdateUserLocation 方法
- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation {
if (!userLoc)
{
//NSLog(@"Mapping - didUpdateUserLocation");
userLoc = userLocation.location;
}
[locationManager startUpdatingLocation];
}
我还确保不会删除用户的注释
if (![annotation isKindOfClass:[MKUserLocation class]])
...那么为什么蓝点在 iPhone 上显示并闪烁,但仅在 iPad 上显示为白点? (两台设备均为iOS 7.1.1)
只有具有蜂窝网络功能的 iPad 才能访问 GPS,这就是 MKMapView 中蓝色脉冲点所代表的位置。每部 iPhone 都有 GPS,这就是您在该设备上看到脉冲点的原因。
如果没有蜂窝网络(3G/4G/LTE),iPad 只能使用 WiFi 来三角测量位置,这对于导航来说不够准确。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)