I have three arrays of annotations in my app, foodannotations, gasannotations, and shoppingannotations. I want each array of annotations to show a different colored pin. I am currently using
- (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;
}
How can I set this up to use the three different pin colors for each array of annotations.
Thanks!