2012-03-01 13 views
6

En mi viewWillAppear para un punto de vista que tienenMKPointAnnotation - ¿Título del espectáculo predeterminado y animado?

MKPointAnnotation *point = [[MKPointAnnotation alloc] init]; 

[point setCoordinate:(myLocation)]; 
[point setTitle:@"Here it is!"]; 

[mapView addAnnotation:point]; 

[mapView setRegion:adjustedRegion animated:YES]; 

Esto añade el punto al mapa como pretendo. Sin embargo, tengo que tocarlo para ver el texto destacado.

¿Cómo puedo hacer que muestre la leyenda por defecto?

He intentado añadir esto justo después: [self.mapView selectAnnotation:annotation animated:YES];

Pero no parecía funcionar ... ¿tengo que usar una anotación real y no un MKPointAnnotation para hacer esto?

+0

Una MKPointAnnotation es una anotación real: ese no es el problema. Consulte http://stackoverflow.com/questions/7884379/mkannotation-not-getting-selected-in-ios5, http://stackoverflow.com/questions/978897/how-to-trigger-mkannotationviews-callout-view-without -touching-the-pin, etc. – Anna

Respuesta

15

ha asignado el nombre de anotación point no annotation:

[mapView selectAnnotation:point animated:YES]; 

Le pasa a lo mejor de nosotros.

0

rápida 3

recordatorio esta acción después de la addAnnotation.

mapView.addAnnotation(point) 

mapView.selectAnnotation(point, animated: true)