I am using this sample app to make route
It will call the routing api and parse the result.
Then a new layer is added above the map with the route between A and B.
My problem is how can i place two color pins ? Right now Its showing 2 red color pins. But I need 1 red and 1 green.
I am trying to work with this delegate, but its not helping me
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
- (MKAnnotationView *)mapView:(MKMapView *)mapView
viewForAnnotation:(id <MKAnnotation>)annotation {
if(annotation == yourFirstAnnotation)
{
MKPinAnnotationView *annView=[[MKPinAnnotationView alloc] initWithAnnotation:yourFirstAnnotation reuseIdentifier:[annotation title]];
annView.pinColor = MKPinAnnotationColorRed;
annView.animatesDrop=NO;
annView.canShowCallout = YES;
return [annView autorelease];
}
else
if(annotation == yourSecondAnnotation)
{
MKPinAnnotationView *annView=[[MKPinAnnotationView alloc] initWithAnnotation:yourSecondAnnotation reuseIdentifier:[annotation title]];
annView.pinColor = MKPinAnnotationColorGreen;
annView.animatesDrop=NO;
annView.canShowCallout = YES;
return [annView autorelease];
}
}
I think if it doesn't work make use of isEqual:
instead of ==
.