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];

posted @ 2014-11-30 13:36  needly  阅读(444)  评论(0编辑  收藏  举报