MKMapView中天上戳下大头针的效果

MKPinAnnotationView的animatesDrop属性

有大头针没有动画,设置以下animatesDrop=YES

如果想自定义大头针想有动画,那需要参考下面代码自己写个动画

复制代码
  1. #pragma mark MKMapViewDelegate
  2. - (void)mapView:(MKMapView *)mapView didAddAnnotationViews:(NSArray *)views
  3. {
  4.     MKAnnotationView *annotationView;
  5.     for (annotationView in views)
  6.     {
  7.         if (![annotationView isKindOfClass:[MKPinAnnotationView class]])
  8.         {
  9.             CGRect endFrame = annotationView.frame;
  10.             annotationView.frame = CGRectMake(endFrame.origin.x, endFrame.origin.y - 230.0, endFrame.size.width, endFrame.size.height);
  11.             
  12.             [UIView beginAnimati*****:@"drop" context:NULL];
  13.             [UIView setAnimationDuration:0.45];
  14.             [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
  15.             [annotationView setFrame:endFrame];
  16.             [UIView commitAnimati*****];
  17.         }
  18.     }
  19. }

你可能感兴趣的:(null,Class,UIView)