如何将注释引脚颜色更改为原始?

时间:2013-01-09 08:38:41

标签: ios ios6 mkmapview mkannotation ios6-maps

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

1 个答案:

答案 0 :(得分: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文件