ios键盘回收终极版
#pragma mark UITextViewDelegate
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
if ([@"\n" isEqualToString:text] == YES)
{
[textView resignFirstResponder];
return NO;
}
return YES;
}
UITextView *tv = [[UITextView alloc] initWithFrame: CGRectMake(20, 60, 260, 120)];
tv.keyboardType = UIKeyboardAppearanceDefault;
tv.returnKeyType = UIReturnKeyDone;
tv.delegate = self;
[self.window addSubview: tv];