En forma wich podría yo llamar a la función que se abren automáticamente mi anotación (con título, subtítulo, etc.), en lugar de tocar en la anotación en el MapView?
"CanShowCallOut" IPHONE automática de anotación
votos
4
2 respuestas
votos 4
4
Implementar MKMapViewDelegatedelegado;
implementar - (MKAnnotationView *) mapView: (MKMapView *) mapView_ viewForAnnotation: (id <MKAnnotation>) annotation_;; por ejemplo como esta:
- (MKAnnotationView *) mapView: (MKMapView *) mapView_ viewForAnnotation: (id <MKAnnotation>) annotation_ {
MKPinAnnotationView *pin = (MKPinAnnotationView *) [self.mapView dequeueReusableAnnotationViewWithIdentifier: @"YourPinId"];
if (pin == nil) {
pin = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation_ reuseIdentifier: @"YourPinId"] autorelease];
}
else {
pin.annotation = annotation_;
}
pin.pinColor = MKPinAnnotationColorRed;
[pin setCanShowCallout:YES];
pin.animatesDrop = YES;
return pin;
}
Mostrar el pin después de que el mapa ha terminado de cargar:
- (void) dropPin {
[mapView addAnnotation:self.annotation];
[mapView selectAnnotation:self.annotation animated:YES];
}
- (void) mapViewDidFinishLoadingMap: (MKMapView *) mapView_ {
// if done loading, show the call out
[self performSelector:@selector(dropPin) withObject:nil afterDelay:0.3];
}
Este código tiene una propiedad llamada anotación que implementa MKAnnotation. Además, se anima a la caída de un alfiler también, pero debe ser bastante autoexplicativo.
HTH.
votos 3
3
Alfons responde a la pregunta, pero si usted está buscando exactamente lo que abre automáticamente la llamada, es esta parte:
[mapView selectAnnotation:annotation animated:YES];













