我在我的app,foodannotations,gasannotations和shoppingannotations中有三个注解数组。我希望每个注释数组显示不同的彩色别针。我目前正在使用注释的多个阵列,每个阵列的不同针脚颜色?
- (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;
}
我怎样才能设置这一点,以便为每个注释数组使用三种不同的针脚颜色。
谢谢!
有没有办法,我可以做到这一点使用内置的mkpinannotationview和pinview.pincolor = ____? – Matt
是的,你也可以使用'MKAnnotationView'的pinColor属性来做到这一点。此外,我更新了一个更相关的链接我的问题。 –
非常感谢!我现在要开始工作了! – Matt