I'm working on an app that makes use of the MapKit Classes Mkannotation and MKAnnotationView (Both subclassed, of course).
My question is, how can I put multiple FGAnnotationViews on my map (about 5) that all have different images?
I know that I could create 5 different new Classes and init the one matching, but I thought, that maybe there was a method to put an if statement inside the
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
function, like
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation {
MKAnnotationView *annView = nil;
if (annotation == myRestaurantAnnotation) {
FGAnnotationView *fgAnnView = (FGAnnotationView*)[self.mapView dequeueReusableAnnotationViewWithIdentifier:@"Location"];
fgAnnView = [[FGAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"Location"];
}
return annView;
}
Anyone?