1

私は MapKit を使用していますが、正確な問題が発生しています。

これは私のコードです:

- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation {
    static NSString *identifier = @"MyLocation";
    if ([annotation isKindOfClass:[MyLocation class]]) {

        MKAnnotationView *annotationView = (MKAnnotationView *) [mymap_ios dequeueReusableAnnotationViewWithIdentifier:identifier];
        if (annotationView == nil) {
            annotationView = [[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier];
            annotationView.enabled = YES;
            annotationView.canShowCallout = YES;

        } else {
            annotationView.annotation = annotation;
        }
        annotationView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
        return annotationView;
    }

    return nil;
}

このコードでは、ピンは表示されますが、その横にある青いボタンは表示されません。私はこれをするのを忘れていたようです:

mymap_ios.delegate=self;

しかし、これを追加すると、マーカーはまったく表示されません。

それについて私を助けてもらえますか?

4

1 に答える 1