Reputation: 5831
I have the following code:
- (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;
}
This method changes every annotation on the mapview, including the current location blue circle annotation. I want to change only my custom annotations and leave the current location annotation alone.
How can I do this?
Upvotes: 2
Views: 1480
Reputation: 1993
Return nil if the annotation is the userLocation annotation
if(annotation == mapView.userLocation){
return nil;
}
Upvotes: 5