Chr*_* K. 4 mkmapview mkannotation mkannotationview ios ios7
有人知道为什么我不能强制mapView标注使用detailDisclosureBtn而不是infoButton?
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
{
static NSString *identifier = @"HPIPAnnotation";
if ([annotation isKindOfClass:[CoreCityAnnotation class]])
{
MKPinAnnotationView *annotationView = (MKPinAnnotationView *) [_mapView dequeueReusableAnnotationViewWithIdentifier:identifier];
if (annotationView == nil) {
annotationView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier];
} else {
annotationView.annotation = annotation;
}
UIButton *disclosureButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
annotationView.canShowCallout = YES;
annotationView.animatesDrop = YES;
annotationView.rightCalloutAccessoryView = disclosureButton;
return annotationView;
}
return nil;
}
Run Code Online (Sandbox Code Playgroud)
那是我对代表的实现.
detailDisclosure类型和infoLight/infoDark的按钮图像是相同的.
| 归档时间: |
|
| 查看次数: |
857 次 |
| 最近记录: |