I have a MKPinAnnotationView and in my viewForAnnotation method, I do the following:
customPinView.image = [UIImage imageNamed:@"blah.png"];
I have added blah.png to my resources (by dragging the file in)
But I still see the stock pin and not my image. Am I doing something wrong? Here is the complete code:
- (MKAnnotationView *)mapView:(MKMapView *)map viewForAnnotation:(id <MKAnnotation>)annotation
{
static NSString *AnnotationViewID = @"annotationViewID";
MKAnnotationView *annotationView = (MKAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:AnnotationViewID];
if (annotationView == nil)
{
annotationView = [[[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:AnnotationViewID] autorelease];
}
annotationView.image = [UIImage imageNamed:@"blah.png"];
annotationView.annotation = annotation;
return annotationView;
}