1
(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を使用しているため、このエラーが発生した可能性があります。

4

1 に答える 1

3

両方のタイプの注釈ビューに異なる識別子を割り当てる必要があります。それ以外の場合は、期待されるMKPinAnnotationView場所で終了し、MKAnnotationViewその逆も同様です(ここで経験したことです)。

于 2011-05-24T15:30:25.877 に答える