Aquí hay un ejemplo de texto personalizado del que me gustaría obtener un estilo similar. Estaba pensando en heredar de MKAnnotation, pero estoy perdido en cómo iniciarlo y no sé si el diseño del texto destacado podría anularse.iOS Mapkit Llamada personalizada
Alguna idea de cómo implementar esta llamada personalizado con controles de interfaz de usuario en el interior?
EDIT: Aquí está mi código de detrás de las Stackoverflow similares respuesta:
- (MKAnnotationView *)mapView:(MKMapView *)mapview viewForAnnotation:(id <MKAnnotation>)annotation
{
if ([annotation isKindOfClass:[MKUserLocation class]])
return nil;
static NSString* AnnotationIdentifier = @"AnnotationIdentifier";
MKAnnotationView *annotationView = [mapView dequeueReusableAnnotationViewWithIdentifier:AnnotationIdentifier];
if(annotationView)
return annotationView;
else
{
UIImage *img = [UIImage imageNamed:@"default_thumb.png"];
MKAnnotationView *annotationView =
[[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:AnnotationIdentifier];
annotationView.canShowCallout = YES;
annotationView.image = img;
annotationView.draggable = YES;
/*
// change left accessory view button with image
UIImageView *leftAccView = [[UIImageView alloc] initWithImage:img];
annotationView.leftCalloutAccessoryView = leftAccView;
//include a right button to show more info
UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
[rightButton addTarget:self action:@selector(calloutSubMenu:) forControlEvents:UIControlEventTouchUpInside];
[rightButton setTitle:annotation.title forState:UIControlStateNormal];
annotationView.rightCalloutAccessoryView = rightButton;
*/
return annotationView;
}
return nil;
}
// Customize accessory view
- (void)mapView:(MKMapView *)mapview annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control
{
[mapview deselectAnnotation:view.annotation animated:YES];
PopOverCallout *popOverCallout = [[PopOverCallout alloc]init];
UIPopoverController *popOver = [[UIPopoverController alloc] initWithContentViewController:popOverCallout];
self.annotationPopoverController = popOver;
popOver.popoverContentSize = CGSizeMake(500, 500);
[popOver presentPopoverFromRect:view.bounds inView:view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
El
(void)mapView:(MKMapView *)mapview annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control
deberían ser llamados cada vez que el pasador se toca para mostrar la derecha de llamada? pero lo que sucede es que se muestra una leyenda normal en blanco. ¿Qué podría estar haciendo mal?
BTW: la subclase UIViewController solo tiene una etiqueta en su XIB y está prácticamente en blanco.
Ver [esta pregunta similar] (http://stackoverflow.com/questions/5582564/how-do-i-display-a-uipopoverview-as-a-annotation-to-the-map-view-ipad/ 5583505 # 5583505). – Anna
gracias. Supongo que esta es una copia exacta. Probablemente borre esta pregunta si la solución de la otra publicación es lo que estoy buscando. – Bahamut
@Anna Karenina: ¿podría decirme por qué sigue mostrando un rótulo regular? Agregué mi código – Bahamut