Mam następujące metody w moim MapViewController:iOS - zestaw Szczegóły Przycisk Ujawnienie na MKAnnotationView
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation {
MKAnnotationView *annotationView = [mapView dequeueReusableAnnotationViewWithIdentifier:@"MapVC"];
if (!annotationView) {
annotationView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"MapVC"];
annotationView.canShowCallout = YES;
annotationView.leftCalloutAccessoryView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
annotationView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
// could put a rightCalloutAccessoryView here
} else {
annotationView.annotation = annotation;
[(UIImageView *)annotationView.leftCalloutAccessoryView setImage:nil];
}
return annotationView;
}
Uważam, że jest prawidłowo skonfigurowana, ale kiedy moja mapa pokazuje moje adnotacje z tytułem i podtytułem prawidłowo, ale don wyświetlasz przycisk ujawniania szczegółów, czy czegoś brakuje?
Inną kwestią jest to, że podczas debugowania ta metoda nigdy nie jest wywoływana, ale widok adnotacji wyświetla się wraz z tytułem i podtytułem.