0

注釈がクリックされているかどうかを確認したいので、次のようになります。

まだクリックされていません

に :

クリックするには

アノテーションを表示する私のコードは次のとおりです。

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

if ([annotation isKindOfClass:[MyLocation class]]) {


    MKAnnotationView *annotationView = (MKAnnotationView *) [_mapView dequeueReusableAnnotationViewWithIdentifier:identifier];

    if (annotationView == nil) {
        annotationView = [[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier];
        annotationView.enabled = YES;
        annotationView.canShowCallout = YES;
        annotationView.image = [UIImage imageNamed:@"arrest.png"];//here we use a nice image instead of the default pins
        annotationView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];


    } else {
        annotationView.annotation = annotation;

    }

    return annotationView;

}

return nil;

}

rightCalloutAccesoryViewは、コールアウト内の青いボタンです。しかし、ユーザーが注釈をクリックしたときに何かを非表示にする必要があります。

誰かがこれをチェックする/これを行う方法を知っていますか?

よろしくお願いします

4

1 に答える 1

3
- (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view {
//do your code
}
于 2012-11-16T07:41:40.917 に答える