I have a custom pin in my map view , and I need to enlarge the pin when I tap it, and return to its default size when I press on other pin, just like the foursquare app
this is the code I have for enlarge it, but how I can return it to its default value when I tap another pin
- (void)mapView:(MKMapView *)mapView1 didSelectAnnotationView:(MKAnnotationView *)mapView2
{
id<MKAnnotation> annotation = mapView2.annotation;
if ([annotation isKindOfClass:[MKUserLocation class]]) {
// this is where you can find the annotation type is whether it is userlocation or not...
}
else
{
float spanX = 0.00725;
float spanY = 0.00725;
MKCoordinateRegion region;
region.center.latitude = annotation.coordinate.latitude;
region.center.longitude = annotation.coordinate.longitude;
region.span.latitudeDelta = spanX;
region.span.longitudeDelta = spanY;
[self.mapView setRegion:region animated:YES];
CGRect frame;
MapAnnotation* ann = annotation;
NSInteger ind = [annotationArr indexOfObject:ann];
frame.origin.x = self.cellScrollBar.frame.size.width * ind;
frame.origin.y = 0;
frame.size = self.cellScrollBar.frame.size;
[self.cellScrollBar scrollRectToVisible:frame animated:YES]; // scroll to the cell of the tapped pin
[UIView animateWithDuration:0.5 animations:^{
mapView2.transform =CGAffineTransformMakeScale(1.3,1.3);
}];
}
}
would you please help me with this issue