【发布时间】:2012-10-22 02:47:34
【问题描述】:
我不明白为什么当我在 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”的定义是什么?
-
如何将 pinView.animatesDrop 设置为 YES?
-
不,pinView.animatesDrop 是 NO