나는 costum 이미지를 설정할 때 userLocation이 움직이지 않는 이유를 알지 못합니다.UserLocation 이미지가 움직이지 않음
이미지를 설정하지 않으면 기본 핀은 파란색을 사용하고 작동합니다. 나는 위치가 바뀔 때 사용자 위치가 움직이는 것을 볼 수있다.
여기 내 viewForAnnotation은 다른 게시물에서 가져온 것입니다.
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
{
static NSString* AnnotationIdentifier = @"Annotation";
MKPinAnnotationView *pinView = (MKPinAnnotationView *)[mk dequeueReusableAnnotationViewWithIdentifier:AnnotationIdentifier];
if (!pinView)
{
pinView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:AnnotationIdentifier] autorelease];
pinView.animatesDrop = NO;
pinView.canShowCallout = YES;
}
else
{
pinView.annotation = annotation;
}
if (annotation == mk.userLocation)
pinView.image = [UIImage imageNamed:@"PositionPin.png"];
else
pinView.image = [UIImage imageNamed:@"PositionPin.png"];
return pinView;
}
'mk'의 정의는 무엇입니까? –
죄송합니다 mapView – james075
pinView.animatesDrop을 YES로 설정하는 것은 어떻습니까? –