我有以下代码:
- (MKAnnotationView *) mapView:(MKMapView *) mapView viewForAnnotation:(id ) annotation {
MKPinAnnotationView *customAnnotationView=[[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:nil] autorelease];
customAnnotationView.pinColor = MKPinAnnotationColorRed;
customAnnotationView.animatesDrop = NO;
customAnnotationView.canShowCallout = YES;
UIButton *rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
[rightButton addTarget:self action:@selector(annotationViewClick:) forControlEvents:UIControlEventTouchUpInside];
customAnnotationView.rightCalloutAccessoryView = rightButton;
return customAnnotationView;
}
此方法会更改 map View 上的每个注释,包括当前位置的蓝色圆圈注释。我只想更改我的自定义注释并保留当前位置注释。
我该怎么做?
最佳答案
如果注解是userLocation注解,则返回nil
if(annotation == mapView.userLocation){
return nil;
}
关于ios - 当前位置注释默认是什么样子?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12999972/