8
創建自定義MKAnnoationView如下:定位定製MKAnnotationView
- (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;
}
我得到我想要更多或更少的在正確的位置定位的形象,但並不完全。我的形象看起來是這樣的:
我想要的淚滴底部點對點我的註釋地圖座標,像標準引腳觀點的地圖座標。我怎樣才能做到這一點?目前看起來更像是我的圖像以地圖座標爲中心。
在這種情況下。視圖的中心在精確的座標位置對齊。引腳的底部應該在精度的座標上。 – carbonr