IOS点击空白处隐藏软键盘

 UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(keyboardHide:)];
    //设置成NO表示当前控件响应后会传播到其他控件上,默认为YES。
    tapGestureRecognizer.cancelsTouchesInView = NO;
    //将触摸事件添加到当前view
    [self.view addGestureRecognizer:tapGestureRecognizer];

-(void)keyboardHide:(UITapGestureRecognizer*)tap{
    [_mobileTF resignFirstResponder];
    [_passwordTF resignFirstResponder];
    [_vertifyCodeTF resignFirstResponder];
    [_nameTF resignFirstResponder];
}
注册响应

你可能感兴趣的:(IOS开发)