I am successfully drawing annotations on a map using an array of annotations. I can even click on the annotation and change it’s colour or image. My problem arises when the use selects the second annotation and I want to dynamically change the colour or image of the first one back to a non-selected colour/image. I can get the array of all the annotations and work through the array but once I try to set the colour or image ot the array I get a similar error.
for (MKAnnotationView *ann in map.selectedAnnotations){ if ([ann isMemberOfClass:[Place class]]) { place = (Place *)ann; if (currentPlaceID != place.placeID) { UIImage *i = [UIImage imageNamed:@"pin.png"];
ann.image = i; }
}
the above code works ok until I get to ann.image = i; then it errors. The errors I get are:-
- -[Place setImage:]: unrecognized selector sent to instance 0x4514370 Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '** -[Place setImage:]: unrecognized selector sent to instance 0x4514370'
Please advise as I have been going around in circles on this one for 2 days now!!!!
Any ideas on how best to do this?
thanks in advance Cheryl