Textfield 常用点击收起键盘

键盘退出的方法

//点击屏幕空白处键盘退出

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent*)event{

    [self.textField resignFirstResponder];

}

#pragma mark - UITextFieldDelegate

//点击Return键键盘退出

- (BOOL)textFieldShouldReturn:(UITextField *)textField{

    [textField resignFirstResponder];

    returnYES;

扫描二维码关注公众号,回复: 5746709 查看本文章

}

//监听delegate

-(void)textField1TextChange:(UITextField *)textField{
   
}

猜你喜欢

转载自blog.csdn.net/Harvey_DHui/article/details/79917451
今日推荐