自定义地图注释标注图像

时间:2011-04-01 12:36:54

标签: ios4 annotations mapkit callouts

我可以使用标题,副标题,左侧的图像(leftCalloutAccessoryView)和右侧的按钮(rightCalloutAccessoryView)设置MKPinAnnotationView。
使用此代码,我将图像设置在左侧:


UIImageView *myImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Icon.png"]];
myImageView.frame = CGRectMake(0, 0, 10, 10);
customPinView.leftCalloutAccessoryView = myImageView;
[myImageView release], myImageView = nil;


结果是这样的:
Image 1

但是我想得到这样的东西:
Image 2 图像与副标题对齐的位置。

怎么能得到它?

THX。

1 个答案:

答案 0 :(得分:1)

这将需要使用自定义annotationView。在开发人员资源中有大量关于此的文档。使用默认注释样式无法进行图像对齐。