Is 开发者_JAVA技巧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.
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];
}
精彩评论