点击键盘的回弹效果的两种方法

1 //当点击键盘return键的时候
2 - (BOOL)textFieldShouldReturn:(UITextField *)textField
3 {
4     [textField resignFirstResponder]; // 释放第一响应者
5     NSLog(@"%@",textField.text);
6     return YES;
7 }
1 // 触摸屏幕回收键盘
2 - (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
3 {
4     [self.view endEditing:YES];
5 }
原文地址:https://www.cnblogs.com/leikun1113/p/5539482.html