[英]User location in mapView doesn't show on several simulator devices (MapKit)
[英]User's location doesn't show on the map
我下载了MapBox Me。 用户位置未在地图上显示。 属性mapView.isUserLocationVisible
为YES
。 mapView.showsUserLocation = YES
。 但我在地图上看不到蓝色圆圈或圆点。 我该怎么办才能让它可见?
设置mapView.showsUserLocation = YES
会自动将蓝点添加到地图中。 如果你想以蓝点为中心在屏幕上移动它,你需要mapView.userTrackingMode
。
如果没有更多信息(从您使用的代码开始),就无法确切地知道您在地图上显示用户位置时遇到的问题。
简单地设置Map.showsUserLocation属性不足以显示用户的位置。
当前位置(RMUserLocation)是RMAnnotation的扩展。 如果您想显示您的位置,您可以像其他任何表示法一样将其放在地图上。
我有一个相同的问题,但确实看到RMUserLocation显示一旦GPS在layerForAnnotation方法中可用,但仍未在地图上绘制。
一个可能的原因是您正在尝试为用户位置绘制标记。
尝试添加此代码:
- (RMMapLayer *)mapView:(RMMapView *)mapView layerForAnnotation:(RMAnnotation *)annotation
{
//Show the user location
if( [annotation isKindOfClass:[RMUserLocation class]] )
return nil;
.... run your own code
}
为我解决了它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.