是否可以在MKAnnotationView而不是MKPinAnnotationView中调用animatesDrop? [英] Is it possible to call animatesDrop in a MKAnnotationView rather than MKPinAnnotationView?
本文介绍了是否可以在MKAnnotationView而不是MKPinAnnotationView中调用animatesDrop?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你知道MKPinAnnotationView有一个方法animatesDrop来设置一个带有阴影的地图从顶部到点的注释吗?好的,是否可以使用自定义图像执行此操作?
do you know that MKPinAnnotationView has a method "animatesDrop" to animate a pin annotation from the top to point on the map with a shadow? OK, is it possible do this with a custom image??
推荐答案
您始终可以在MKMapViewDelegate方法中执行自定义动画。
You can always do your custom animation in MKMapViewDelegate method.
- (void)mapView:(MKMapView *)mapView didAddAnnotationViews:(NSArray *)views
可能是这样的(你不会得到花哨的阴影动画,如果你需要它你需要自己做):
Probably something like that (you won't get the fancy shadow animation, if you want it you need to do it yourself) :
- (void) mapView:(MKMapView *)mapView didAddAnnotationViews:(NSArray *)views {
CGRect visibleRect = [mapView annotationVisibleRect];
for (MKAnnotationView *view in views) {
CGRect endFrame = view.frame;
CGRect startFrame = endFrame; startFrame.origin.y = visibleRect.origin.y - startFrame.size.height;
view.frame = startFrame;
[UIView beginAnimations:@"drop" context:NULL];
[UIView setAnimationDuration:1];
view.frame = endFrame;
[UIView commitAnimations];
}
}
这篇关于是否可以在MKAnnotationView而不是MKPinAnnotationView中调用animatesDrop?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文