实现textFiel和textView中的键盘的关闭
实现委托UITextFieldDelegate, UITextViewDelegate里以下方法
#pragma mark 放弃“第一响应者”
-(BOOL)textFieldShouldReturn:(UITextField *)textField{
[textField resignFirstResponder];
return YES;
}
-(BOOL)textView:(UITextView *) textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text{
if([text isEqualToString:@"\n"]){
[textView resignFirstResponder];
return NO;
}
return YES;
}