在标题内的MKAnnotationView中添加图片

时间:2013-01-31 15:09:51

标签: ios xcode mkmapview mkannotation mkannotationview

我正在搜索允许我这样做的任何lib:

1 http://zsoft.es/imgs/annotations.jpg

并且可能在标题的右侧部分添加一个按钮,如果可能的话,在副标题中添加更多图像或在副标题中添加按钮......

感谢。

2 个答案:

答案 0 :(得分:1)

您可以在MKAnnotationView上设置以下属性。

// The left accessory view to be used in the standard callout.
@property (retain, nonatomic) UIView *leftCalloutAccessoryView;

// The right accessory view to be used in the standard callout.
@property (retain, nonatomic) UIView *rightCalloutAccessoryView;

答案 1 :(得分:1)

来自Apple documentation使用leftCalloutAccessoryView

(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation

您可以将UIImageView分配给leftCalloutAccessoryView

myAnnotationView.leftCalloutAccessoryView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"myImage.png"]