preventing selection on MKPointAnnotation
Posted
by
Derek
on Stack Overflow
See other posts from Stack Overflow
or by Derek
Published on 2012-07-01T20:46:53Z
Indexed on
2012/07/01
21:16 UTC
Read the original article
Hit count: 200
Is there a way to prevent an annotation in a MKMapView instance from being enabled. In other words, when the user taps the red pin on the map, is there a way to prevent it from highlighting the pin. Right now the pin turns dark when touched...
Edit: I'm using the following code to return the MKPinAnnotationView
// To future MKMapView users - Don't forget to set _mapView's delegate
_mapView.delegate = self;
_annotation = [[MKPointAnnotation alloc] init];
_annotation.coordinate = myLocation;
[_mapView addAnnotation:_annotation];
-(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation{
MKPinAnnotationView *pin = [[MKPinAnnotationView alloc] initWithAnnotation:_annotation reuseIdentifier:@"id"];
pin.enabled = NO;
return pin;
}
© Stack Overflow or respective owner