iOS 键盘

直接关闭:

[[[UIApplication sharedApplication] keyWindow] endEditing:YES];

[self.view endEditing:YES];


text.returnKeyType =UIReturnKeyDone;//完成

text.delegate =self;



-(BOOL)textFieldShouldReturn:(UITextField *)textField

{

UITextField * name =(UITextField *)[self.view viewWithTag:1222];

[name resignFirstResponder];

return YES;

}

//点击屏幕空白处去掉键盘

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event

{

UITextField * name =(UITextField *)[self.view viewWithTag:1222];

[name resignFirstResponder];

}

你可能感兴趣的:(iOS 键盘)