Question

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

Était-ce utile?

La solution

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

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top