实现UITapGestureRecognizer后,UITableView不再响应

时间:2013-05-21 05:36:51

标签: ios ipad uitableview uitapgesturerecognizer

在我的视图控制器中,我有一个表格视图和一些自定义UIView。在视图控制器中,为某些交互式UI工作实现了UITapGestureRecognizer。现在,UITableView不再响应UITapGestureRecognizer了。从调试开始,它似乎直接进入UITapGestureRecognizer选择器方法,并且永远不会调用didSelectRowAtPath

由于

1 个答案:

答案 0 :(得分:1)

首先,您需要在视图上添加Tap Gesture。 并记住<UIGestureRecognizerDelegate>添加.h文件。

UITapGestureRecognizer *doubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(doubleTap1ImgView:)];
        doubleTap.numberOfTapsRequired = 2;
        doubleTap.delegate = self;


        [self.ImgView addGestureRecognizer:doubleTap];
        self.ImgView.userInteractionEnabled=YES;




- (void)doubleTap1ImgView:(UITapGestureRecognizer *)gesture
{
            // Do What you want here
}