【发布时间】:2012-02-21 04:41:22
【问题描述】:
我的 MapViewController 中有以下方法:
- (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;
}
我相信它设置正确,但是当我的地图正确显示带有标题和副标题的注释时,但它们没有显示详细信息披露按钮,我是否遗漏了什么?
另外一点是,在调试时这个方法从来没有被调用过,但是注解视图却显示了标题和副标题。
【问题讨论】:
标签: ios uibutton mapkit mkannotation mkannotationview