I'm trying to change the image of the pin on the map in the picture. But no matter how I tried to pin it, it continues to look like an ordinary pin. My code

-(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation { if ([annotation isKindOfClass:[MKUserLocation class]]) { return nil; } static NSString* identifier = @"Annotation"; MKPinAnnotationView* pin = (MKPinAnnotationView*)[mapView dequeueReusableAnnotationViewWithIdentifier:identifier]; if (!pin) { pin = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier]; pin.image = [UIImage imageNamed:@"хххх"]; pin.animatesDrop = YES; pin.canShowCallout = YES; pin.draggable = YES; } else { pin.annotation = annotation; } return pin; } 

what am I doing wrong?

    1 answer 1

    Replace your MKPinAnnotationView with MKAnnotationView .

    • thanks, earned - Hudihka