ViewDidLoad中注册手势的部分代码如下: [cpp] view plaincopy UITapGestureRecognizer *oneTap = [[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hideKeyBoard)] autorelease]; oneTap.delegate = self; oneTap.numberOfTouchesRequired = 1; [self.view addGestureRecognizer:oneTap]; 其中hideKeyBoard方法就省略了,基本就是几个resignFirstResponder。 然后发生了一个奇怪的现象,点击“找回密码”那一栏时没有反应了!!! 调试后我发现委托方法 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath*)indexPath不执行了。 目测原因是UITapGestureRecognizer截获了touch事件,导致didSelectRowAtIndexPath方法无法响应。 查阅了相关文档后找到了一种可行的解决方法:重写UIGestureRecognizerDelegate中的 - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch方法。 [cpp] view plaincopy #pragma mark - UIGestureRecognizerDelegate - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch { // 输出点击的view的类名 NSLog(@"%@", NSStringFromClass([touch.view class])); // 若为UITableViewCellContentView(即点击了tableViewCell),则不截获Touch事件 if ([NSStringFromClass([touch.view class]) isEqualToString:@"UITableViewCellContentView"]) { return NO; } return YES; } 再次调试,这回didSelectRowAtIndexPath响应了,解决UITapGestureRecognizer手势截获Touch事件的问题!