Проверьте, нажата ли кнопка вызова аннотации

Я хочу проверить, нажата ли аннотация: Итак, отсюда:

Еще не нажали

Кому:

Чтобы нажали

Вот мой код, который показывает аннотацию:

- (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 - синяя кнопка внутри выноски. Но мне нужно что-то скрыть, когда пользователь нажимает на аннотацию.

Кто-нибудь знает, как это проверить / сделать это?

Спасибо заранее

1 ответ

Решение
- (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view {
//do your code
}
Другие вопросы по тегам