objective c - preventing selection on MKPointAnnotation -
is there way prevent annotation in mkmapview instance being enabled. in other words, when user taps red pin on map, there way prevent highlighting pin. right pin turns dark when touched...
edit: i'm using following code return mkpinannotationview
// future mkmapview users - don't forget 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; }
set enabled
no
on mkpinannotationview
, return -mapview:viewforannotation:
delegate method (if haven't implemented it, it).
- (mkannotationview *)mapview:(mkmapview *)mapview viewforannotation:(id <mkannotation>)annotation { static nsstring *annotationidentifier = @"annotation"; mkpinannotationview *annotationview = (mkpinannotationview *)[mapview dequeuereusableannotationviewwithidentifier:annotationidentifier]; if (!annotationview) { annotationview = [[mkpinannotationview alloc] initwithannotation:annotation reuseidentifier:annotationidentifier]; } else { annotationview.annotation = annotation; } annotationview.enabled = no; return annotationview; }
Comments
Post a Comment