当前位置注释的默认外观?

Ile*_*ian 2 mapkit mkannotation mkannotationview ios

我有以下代码:

- (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;
}
Run Code Online (Sandbox Code Playgroud)

此方法更改地图视图上的每个注释,包括当前位置的蓝色圆圈注释。我只想更改自定义注释,而仅保留当前位置注释。

我怎样才能做到这一点?

Jor*_*ijk 5

如果注释是userLocation注释,则返回nil

if(annotation == mapView.userLocation){
    return nil;
}
Run Code Online (Sandbox Code Playgroud)