1

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

Indrajeet
  • 5,490
  • 2
  • 28
  • 43
ghasso
  • 25
  • 4
  • Have you tried using the didDeselectAnnotationView delegate method which is called when an annotation is de-selected? –  Aug 20 '14 at 10:47
  • don't know why i didn't see this method before !! ,, yes i try it now and it working ,, but there is more thing , to make it back whats the trasformScale i should use is it -1.3 and -1.3 ? – ghasso Aug 21 '14 at 08:19
  • Try setting the transform to `CGAffineTransformIdentity`. –  Aug 21 '14 at 10:28

0 Answers0