点击空白关闭键盘的方法

1.添加tap手势
self.userInteractionEnabled = YES;

UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(fingerTapped:)];

[self.view addGestureRecognizer:singleTap];

-(void)fingerTapped:(UITapGestureRecognizer *)gestureRecognizer
{

[self.view endEditing:YES];

}

2.调动touchesBegan方法
2.1.
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
[self.telTextField resignFirstResponder];
}

2.2
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
[self.view endEditing:YES];
}

推荐阅读更多精彩内容