Hi I want to resign the keyboard from the text view as a first responder.I want as soon as user hits the return key after editing in a textView the keyboard should resign.But I am not sure how should I do this???
A:
If your class is set as the delegate for that textview just do the following in your class code
- (void)textViewTextDidEndEditing:(UITextView *)textView {
[textView resignFirstResponder];
}
arclight
2010-06-10 15:05:43
but as i press the return key it just comes to the next line
anurag
2010-06-10 15:28:28
A:
Hope this code helps to you.
-- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
if ([text isEqualToString:@"\n"]) {
[textView resignFirstResponder];
}
return YES;
}
use UITextViewDelegate protocol and yourTextViewName.delegate = self;
mac
2010-06-10 16:12:51