Domanda

I am change annotation pin color when clicking annotation pin and click another annotation pin change pin color so currently two annotation color changed,but i want currently choosing annotation color only changed old selection back to original color. Thanks in advance

È stato utile?

Soluzione

i found a solution create a

@property (nonatomic, retain) MKAnnotationView *selectedAnnotationView;

in .h file and save when clicked in annotation pin

- (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view
{
if (self.selectedAnnotationView) {
    self.selectedAnnotationView.image = [UIImage imageNamed:[NSString    stringWithFormat:@"a.png"]];
}
self.selectedAnnotationView = view;
view.image = [UIImage imageNamed:[NSString stringWithFormat:@"b.png"]];
}

change in .m file

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top