UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapOnView:)];
//这里写在UIView中,如果是在UIViewController使用[self.view addGestureRecognizer:tap];
[self addGestureRecognizer:tap];
- (void)tapOnView:(UITapGestureRecognizer *)sender {
CGPoint location = [sender locationInView:self];
//判断点击的位置
NSLog(@"Tap at %1.0f, %1.0f", location.x, location.y);
//回收键盘
[_textField endEditing:YES];
}