Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom pin animation - MKMapView

Tags:

iphone

I have used pin images in application instead of standard pin, now i want to give animation (dropping effect as it was with standard pins) to custom pins. How can i provide dropping animation effect to custom pin images????

like image 266
Matrix Avatar asked Apr 16 '10 19:04

Matrix


Video Answer


1 Answers

Implement the following delegate method.

- (void)mapView:(MKMapView *)mapView didAddAnnotationViews:(NSArray *)views { 
   MKAnnotationView *aV; 
   for (aV in views) {
     CGRect endFrame = aV.frame;

     aV.frame = CGRectMake(aV.frame.origin.x, aV.frame.origin.y - 230.0, aV.frame.size.width, aV.frame.size.height);

     [UIView beginAnimations:nil context:NULL];
     [UIView setAnimationDuration:0.45];
     [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
         [aV setFrame:endFrame];
     [UIView commitAnimations];

   }
}
like image 165
Biranchi Avatar answered Oct 20 '22 00:10

Biranchi