0

我在单击注释引脚时更改注释引脚颜色,然后单击另一个注释引脚更改引脚颜色,因此当前更改了两个注释颜色,但我希望当前选择注释颜色仅将旧选择更改回原始颜色。提前致谢

4

1 回答 1

0

我找到了一个解决方案

@property (nonatomic, retain) MKAnnotationView *selectedAnnotationView;

在 .h 文件中并在单击注释引脚时保存

- (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"]];
}

.m 文件中的更改

于 2013-01-09T08:57:07.240 回答