gpt4 book ai didi

ios - 如何去除iOS中mapbox的蓝色和灰色注释

转载 作者:行者123 更新时间:2023-11-28 19:26:55 25 4
gpt4 key购买 nike

如何去除 map 框默认显示的用户位置图标

 - (MGLAnnotationView *)mapView:(MGLMapView *)mapView viewForAnnotation:(id<MGLAnnotation>)annotation{
if (mapView.userTrackingMode == MGLUserTrackingModeFollow) {
return nil;
}
return Nil;
}

你好,我已经实现了这段代码。我查看了didload试过了

    mapView.tintColor = [UIColor clearColor];
mapView.backgroundColor = [UIColor clearColor];
[mapView.attributionButton setTintColor:[UIColor clearColor]];

但仍然显示...

最佳答案

Mapbox documentation

you have configured your application’s location permissions, display the device’s current location on the map by setting the showsUserLocation property on the map view to NO

- (void)viewDidLoad {
[super viewDidLoad];


MGLMapView *mapView = [[MGLMapView alloc] initWithFrame:self.view.bounds];
mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[mapView setCenterCoordinate:CLLocationCoordinate2DMake(40.74699, -73.98742)
zoomLevel:9
animated:NO];
[self.view addSubview:mapView];


mapView.styleURL = [MGLStyle satelliteStreetsStyleURL];


// Add a point annotation
MGLPointAnnotation *annotation = [[MGLPointAnnotation alloc] init];
annotation.coordinate = CLLocationCoordinate2DMake(40.77014, -73.97480);
annotation.title = @"Central Park";
annotation.subtitle = @"The best park in New York City!";
[mapView addAnnotation:annotation];


// Set the map view's delegate
mapView.delegate = self;


// Allow the map view to display the user's location
mapView.showsUserLocation = NO;

}

关于ios - 如何去除iOS中mapbox的蓝色和灰色注释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52530082/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com