我添加註釋到我這樣的地圖:改變引腳顏色的MKMapView
MyAnnotation *annotationPoint2 = [[MyAnnotation alloc] init];
annotationPoint2.coordinate = anyLocation;
annotationPoint2.title = [NSString stringWithFormat:@"%@", obj];
annotationPoint2.subtitle = @""; //or set to nil
annotationPoint2.keyValue = [NSString stringWithFormat:@"%@", key];
[mapPins addAnnotation:annotationPoint2];
的引腳都紅了,我想他們都是綠色的。我怎樣才能改變顏色?我曾嘗試以下,但它仍然給出了一個紅色標記:
annotationPoint2.pinColor = MKPinAnnotationColorGreen;
此代碼的工作,但即使當前用戶的位置變成綠色,即使我想它藍色的圓圈繞着它。我怎樣才能做到這一點? – Alessandro
if([[annotation title] isEqualToString:@「Current Location」]) annular.pinColor = MKPinAnnotationColorGreen; } else {annView.pinColor = MKPinAnnotationColorRed;} – casillas
@Alessandro您需要在註解==時返回nil == mapView.userLocation顯示用戶位置的藍點以及圍繞它的圓點 – amitshinik