键盘收回方法

 1 -(BOOL)textFieldShouldReturn:(UITextField *)textField
 2 {
 3     [textField resignFirstResponder];
 4     return NO;
 5 }
 6 
 7 - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
 8 {
 9     [self.gMonthTextField resignFirstResponder];
10 }
11 
12 - (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
13 {
14     [self.gMonthTextField resignFirstResponder];
15     [[[UIApplication sharedApplication] keyWindow] endEditing:YES];
16     [self.view endEditing:YES];
17     [[UIApplication sharedApplication] sendAction:@selector(resignFirstResponder) to:nil from:nil forEvent:nil];
18 }

 

posted @ 2016-06-16 16:18  FMDN  阅读(247)  评论(0)    收藏  举报