Tengo una MKAnnotationView personalizada donde configuro mi imagen en viewForAnnotation. ¿Cómo puedo animar su caída como puedo con MKPinAnnotationView?¿Cómo puedo animar MKAnnotationView drop?
Mi código es
- (MKAnnotationView *)mapView:(MKMapView *)map viewForAnnotation:(id <MKAnnotation>)annotation
{
static NSString *AnnotationViewID = @"annotationViewID";
MKAnnotationView *annotationView = (MKAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:AnnotationViewID];
if (annotationView == nil)
{
annotationView = [[[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:AnnotationViewID] autorelease];
}
annotationView.image = [UIImage imageNamed:@"blah.png"];
annotationView.annotation = annotation;
return annotationView;
}
¡Gracias, eso funcionó! ¿Cómo lo haría rebotar en lugar de caer desde arriba? – DeShawnT
Puede usar todas las técnicas de animación de UIView con la vista de anotación (es una subclase de UIView). El ejemplo anterior simplemente cambia la coordenada y pero puede hacer otras transformaciones. Busque SO para algo como "uiview bounce animation" para ver ejemplos. Aquí hay uno: http://stackoverflow.com/questions/2160150/mimic-uialertview-bounce/4200005#4200005. Deberá agregar QuartzCore framework, importarlo y cambiar "view" a "annView". – Anna
@AnnaKarenina, pero ¿cómo podemos agregar CustomView como nuestro pinView y customCallOut referencias. – AJPatel