2011-08-20 59 views
0

如何爲我的針腳顯示多種顏色?多種顏色的針腳MKMapView

我有一個引腳使用此項功能:

c1.latitude = 48.7258729; 
c1.longitude = 4.5781534; 
HistoryMarker* ad15 = [[HistoryMarker alloc] initWithCoordinate:c1 Title:@"Title" SubTitle:@"SubTitle"]; 

[mapView addAnnotation:ad15]; 
[ad15 release];" 

和另一個用戶的研究

晚安! (對我來說,我是法國人)=

回答

0

MKPinAnnotationView只能是3種顏色中的一種,每種顏色都有自己應該表示的指導原則。如果你想要更多,你必須實現自己的。

編輯:要設置引腳的顏色,你只需要設置引腳顏色屬性:

pin.pinColor = MKPinAnnotationColorRed; 
pin.pinColor = MKPinAnnotationColorGreen; 
pin.pinColor = MKPinAnnotationColorPurple; 

希望幫助!

+0

感謝您的回答,但我如何實現兩個不同的引腳? –

1

要設置引腳顏色,請使用MKPinAnnotationView pinColor屬性。

對於自定義註釋圖像,請像這樣設置MKAnnotationView圖像屬性。

UIImage *annImage = [UIImage imageNamed:@"AnnotationIcon.png"]; 
annView.image = annImage; 

請注意,MKPinAnnotationView animateDrop屬性在自定義圖像上不起作用。有一種方法可以複製該動畫。請參閱How do I animate MKAnnotationView drop?