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 回答