私のアプリには、注釈の3つの配列、フードノーテーション、ガス注釈、ショッピングノートがあります。注釈の各配列に異なる色のピンを表示する必要があります。私は現在使用中です注釈の複数の配列、各配列の異なるピンカラー?
- (MKAnnotationView *)mapView:(MKMapView *)sheratonmap viewForAnnotation:(id<MKAnnotation>)annotation {
NSLog(@"Welcome to the Map View Annotation");
if([annotation isKindOfClass:[MKUserLocation class]])
return nil;
static NSString* AnnotationIdentifier = @"Annotation Identifier";
MKPinAnnotationView* pinview = [[[MKPinAnnotationView alloc]
initWithAnnotation:annotation reuseIdentifier:AnnotationIdentifier] autorelease];
pinview.animatesDrop=YES;
pinview.canShowCallout=YES;
pinview.pinColor=MKPinAnnotationColorPurple;
UIButton* rightbutton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
[rightbutton setTitle:annotation.title forState:UIControlStateNormal];
[rightbutton addTarget:self action:@selector(showDetails) forControlEvents:UIControlEventTouchUpInside];
pinview.rightCalloutAccessoryView = rightbutton;
return pinview;
}
アノテーションの配列ごとに3種類のピンカラーを使用するように設定するにはどうすればよいですか。
ありがとうございます!
私はこれをmkpinannotationviewとpinview.pincolor = ____の組み込み関数を使って行うことはできません。 – Matt
はい、あなたは 'MKAnnotationView'のpinColorプロパティを使ってそれを行うこともできます。また、より関連性の高いリンクで質問を更新しました。 –
ありがとうございました!私は今すぐその仕事をするつもりです! – Matt