(MKAnnotationView *) mapView:(MKMapView *)theMapView
viewForAnnotation:(id <MKAnnotation>)annotation
{
if ([annotation isKindOfClass: [MyLocation class] ])
{
MKPinAnnotationView *annotationView = (MKPinAnnotationView *) [theMapView dequeueReusableAnnotationViewWithIdentifier:placemarkIdentifier];
if(annotationView == nil)
{
annotationView = [[MKPinAnnotationView alloc]initWithAnnotation:annotation reuseIdentifier:placemarkIdentifier];
}
else
{
annotationView.annotation = annotation;
}
annotationView.enabled = YES;
annotationView.animatesDrop = NO;
annotationView.pinColor = MKPinAnnotationColorPurple;
annotationView.canShowCallout = YES;
annotationView.draggable = YES;
return annotationView;
}
}
[MKAnnotationView setAnimatesDrop:]:
无法识别的选择器发送到实例。我使用了许多注释类(MKPinAnnotationView 和 MKAnnotationView)。可能是因为我使用了 dequeueReusableAnnotationViewWithIdentifier 而发生了这个错误。