tôi có phương pháp sau đây trong MapViewController tôi:iOS - Đặt chi tiết Tiết lộ Nút trên 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;
}
Tôi tin rằng nó được thiết lập đúng, nhưng khi bản đồ của tôi cho thấy các chú thích của tôi với tiêu đề và phụ đề đúng, nhưng họ sẽ không bao không hiển thị nút tiết lộ chi tiết, tôi có thiếu cái gì không?
Một điều nữa là khi gỡ lỗi phương thức này không bao giờ được gọi, nhưng chế độ xem chú thích hiển thị với tiêu đề và tiêu đề phụ.