0

I am new. I would like to change my Pin images in my mapview. How can change the image of the annotation? I am sure I am missing something here.

- (MKAnnotationView *)mapView:(MKMapView *)mapview viewForAnnotation:(id <MKAnnotation>)annotation
{
    static NSString *identifier= @"myAnnotation";

    if ([annotation isKindOfClass:[MapPin class]]) {
        MKAnnotationView *view =
        [self.mapview dequeueReusableAnnotationViewWithIdentifier:identifier];
        {
            view = [[MKAnnotationView alloc]initWithAnnotation:annotation reuseIdentifier:identifier];
            view.enabled =YES;
            view.canShowCallout =YES;
            view.image =[UIImage imageNamed:@"imagePin.png"];

        }
                return  view;

        }
    return  nil;
}

0 Answers0