0

this 코드를 사용하여 MKPointAnnotation에 이미지를 추가하고 있습니다.사용자 위치 이미지를 변경하지 않고 MKPointAnnotation에 이미지 추가

- (MKAnnotationView *)mapView:(MKMapView *)theMapView viewForAnnotation:(id <MKAnnotation>)annotation 
{ 
    static NSString *SFAnnotationIdentifier = @"SFAnnotationIdentifier"; 
    MKPinAnnotationView *pinView = 
    (MKPinAnnotationView *)[_routeMap dequeueReusableAnnotationViewWithIdentifier:SFAnnotationIdentifier]; 
    if (!pinView) 
    { 
     MKAnnotationView *annotationView = [[MKAnnotationView alloc] initWithAnnotation:annotation 
                     reuseIdentifier:SFAnnotationIdentifier]; 
     UIImage *flagImage = [UIImage imageNamed:@"BikeIconMap"]; 
     // You may need to resize the image here. 
     annotationView.image = flagImage; 
     return annotationView; 
    } 
    else 
    { 
     pinView.annotation = annotation; 
    } 
    return pinView; 
} 

그러나 사용자 위치에 대한 맞춤 이미지도 표시하고 있습니다. 사용자 위치의 원형 파동 애니메이션도 사라졌습니다.

enter image description hereenter image description here

사용자 위치 이미지와 애니메이션을 변경하지 않고 MKPointAnnotation에 이미지를 추가하는 방법이 있나요?

답변

1

하면 viewForAnnotation이 코드를 추가하는 방법을

- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation 
{ 
    if (annotation == mapView.userLocation) return nil; 
MKMapViewDelegate