我正在使用iOS版Google地图SDK,尝试将当前位置的蓝色点改为红色点,但我找不到方法。
是否有可能将当前位置的蓝色点更改为自定义(红色点)颜色?
如果可以,请帮我解决这个问题。
提前感谢您的帮助。
我正在使用iOS版Google地图SDK,尝试将当前位置的蓝色点改为红色点,但我找不到方法。
是否有可能将当前位置的蓝色点更改为自定义(红色点)颜色?
如果可以,请帮我解决这个问题。
提前感谢您的帮助。
只需更改色调颜色。
mapView.tintColor = UIColor.red
你应该包含MKMapViewDelegate。调用该方法
- (MKAnnotationView *)mapView:(MKMapView *)mapView
viewForAnnotation:(id<MKAnnotation>)annotation;
将注释视图更改为您喜欢的自定义视图。 您可以提供任何图像。
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation {
static NSString* AnnotationIdentifier = @"Annotation";
MKPinAnnotationView *pinView = (MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:AnnotationIdentifier];
if (!pinView) {
MKPinAnnotationView *customPinView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:AnnotationIdentifier] autorelease];
if (annotation == mapView.userLocation){
customPinView.image = [UIImage imageNamed:@"YourLocationimage.png"];
}
else{
customPinView.image = [UIImage imageNamed:@"Notyourlocationimage.png"];
}
return customPinView;
} else {
pinView.annotation = annotation;
}
return pinView;
}