我创建了一个自定义的MKAnnoationView,代码如下:
- (MKAnnotationView *)mapView:(MKMapView *)theMapView viewForAnnotation:(id <MKAnnotation>)annotation
{
static NSString* AnnotationIdentifier = @"AnnotationIdentifier";
MKAnnotationView* customPinView = [[MKAnnotationView alloc]
initWithAnnotation:annotation reuseIdentifier:AnnotationIdentifier];
UIImage *pinImage = [PowerPlantAnnotation getAnnotationImageForEnergySource:((PowerPlantAnnotation*)annotation).energySource];
customPinView.image = pinImage;
return customPinView;
}
我已经将我想要的图片放置在大致正确的位置,但还不够完美。我的图像如下:
我希望水滴形状的底部指向我的注释地图坐标,就像标准的引脚视图指向地图坐标一样。我该怎么做呢?目前,看起来我的图像更像是位于地图坐标中心。