我有一个表单,当按下“提交”按钮时,它会将来自两个文本字段的信息提交给“解析”,并调用此操作,但是当按下按钮时,我无法隐藏键盘,可以使用一些帮助。这是我目前的代码:
-(IBAction)PurchaseSubmitAction:(id)sender{
PFObject *gameScore = [PFObject objectWithClassName:@"Purchase"];
gameScore[@"name"] = FullName.text;
gameScore[@"phone"] = PhoneNumber.text;
[gameScore saveInBackground];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:.3];
[_Purchase setAlpha:0];
[UIView commitAnimations];
[sender resignFirstResponder];
NSLog(@"Load");
}
如何清除键盘?提前致谢。
最佳答案
尝试[yourTextField resignFirstResponder];