本文介绍了目标C:带按钮的ResignFirstResponder的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
UIButton
是否有办法触发resignFirstResponder?当您在文本字段外点击时,我已将程序设置为在功能中执行此操作,但是我希望当用户单击提交"按钮时键盘消失.
Is there a way for a UIButton
to trigger resignFirstResponder?I have my program set to do so in a function when you tap outside of a textfield, but I want the keyboard to go away when the user hits the submit button.
这就是我要使用的UITextFields
This is what I have for the UITextFields
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
[x1 resignFirstResponder];
[x2 resignFirstResponder];
[y1 resignFirstResponder];
[y2 resignFirstResponder];
}
推荐答案
鉴于您提到的方法的存在,如何:
Given the existence of the method you mention, how about:
- (IBAction)solve:(id)sender {
[x1 resignFirstResponder];
[x2 resignFirstResponder];
[y1 resignFirstResponder];
[y2 resignFirstResponder];
}
这篇关于目标C:带按钮的ResignFirstResponder的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!