我使用maps
实现离线和在线MapBox Sdk
。我尝试绘制一个蓝色的半透明圆圈,以显示我在GPS
地图上的实际MapBox Sdk
位置,但它没有显示圆圈。找不到当前位置。谢谢提前
- (void)viewDidLoad {
[super viewDidLoad];
RMMBTilesSource *offlineSource = [[RMMBTilesSource alloc] initWithTileSetResource:@"control-room-0.2.0" ofType:@"mbtiles"];
self.mapView = [[RMMapView alloc] initWithFrame:CGRectMake(0,70, 320, 500) andTilesource:offlineSource];
[self.mapView removeAllAnnotations];
self.mapView.delegate = nil;
self.mapView.userTrackingMode = NO;
[ self.mapView setDelegate:self];
[self.view addSubview: self.mapView];
self.mapView.showsUserLocation = YES;
// default zoom
self.mapView.zoom = 4;
// hard code minimal zoom. Try to run in without it to see what happens.
self.mapView.minZoom = 1;
self.mapView.maxZoom = 8;
self.mapView.tileSourcesMinZoom=5.0;
self.mapView.tileSourcesMaxZoom=16.0;
// hide MapBox logo
self.mapView.showLogoBug = NO;
// hide bottom right "i" icon
[self.mapView setHideAttribution:YES];
self.mapView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
self.mapView.adjustTilesForRetinaDisplay = YES; // these tiles aren't designed specifically for retina, so make them legible
[ self.mapView setUserTrackingMode:RMUserTrackingModeFollow animated:true];
}
答案 0 :(得分:2)
您必须使用此方法:
self.mapView.showsUserLocation = YES;
此外,如果您想更改该RMAnnotaiton的图标,您可以使用:
- (RMMapLayer *)mapView:(RMMapView *)mapView layerForAnnotation:(RMAnnotation *)annotation
{
RMMarker *marker;
if (annotation.isUserLocationAnnotation) {
marker = [[RMMarker alloc] initWithUIImage:[UIImage imageNamed:@"pin-con-halo.png"]];
}
return marker;
}