ddd
2016-09-28 本文已影响17人
Fs_purple
点击view或者tableview隐藏键盘
一般view
```
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
[textFiled resignFirstResponder];
}
```
tableView里面添加手势
#pragma 添加手势
UITapGestureRecognizer *gestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hideKeyboard)];
[self.tableview addGestureRecognizer:gestureRecognizer];
gestureRecognizer.cancelsTouchesInView = NO; //很关键,如果没有这个,tableView的cell的点击事件不会响应。