自定义用户位置注释未遵循位置更新

时间:2012-05-29 08:54:18

标签: iphone objective-c location

我在下面实施了MKMapViewDelegate方法,并显示了自定义用户位置注释。但是,当我带着iPhone走动时,注释没有移动。当我删除这个委托方法时,默认蓝点用户位置注释跟着我。

请告诉我如何移动自定义用户位置注释:

-(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
{
    static NSString* AnnotationIdentifier = @"Annotation";
    MKPinAnnotationView *pinView = (MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:AnnotationIdentifier];
    if (!pinView)
    {
        pinView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:AnnotationIdentifier] autorelease];               
        pinView.animatesDrop = NO;
        pinView.canShowCallout = YES;
    }
    else
    {
        pinView.annotation = annotation;
    }

    pinView.image = [UIImage imageNamed:@"star.png"];

    return pinView;
}

0 个答案:

没有答案