我正在使用GMSMapview,当我在地图上实现单击手势时,该按钮不起作用。我怎样才能做到这一点?

tapRec = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(mapDidTap:)];
tapRec.delegate = self;
tapRec.numberOfTapsRequired = 1;
[mapView2 addGestureRecognizer: tapRec];


 -(void)mapDidTap:(UITapGestureRecognizer *)gestureRecognizer
{
[mapView2 removeGestureRecognizer:tapRec];
_filterView.hidden = YES;
}

最佳答案

GMSMapView具有委托方法。集成此方法。

- (void)mapView:(GMSMapView *)mapView didTapAtCoordinate:(CLLocationCoordinate2D)coordinate

07-26 09:43