![](/img/trans.png)
[英]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.