I have tried just about everything to get an image displayed instead of the default red pin on my MKMapView.
There are a lot of answers about this on the internet but all of them keep giving me this:
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation
{
if([annotation isKindOfClass:[MKUserLocation class]])
return nil;
NSString *annotationIdentifier = @"CustomViewAnnotation";
MKAnnotationView* annotationView = [mapview dequeueReusableAnnotationViewWithIdentifier:annotationIdentifier];
if(!annotationView)
{
annotationView = [[MKAnnotationView alloc] initWithAnnotation:annotation
reuseIdentifier:annotationIdentifier]];
}
annotationView.image = [UIImage imageNamed:@"map_location_pin.png"];
annotationView.canShowCallout= YES;
return annotationView;
}
This doesn't help me at all, its just a method by the looks of it.
Please tell me how to use this to make the method return a annotation with a custom image. Just about all the other answers tell me to implement that method with no further explaination.
Where do I call it? How do I call it?
Thanks!