views:

140

answers:

1

I have a UITextView which I call resignFirstResponder on when the return key is hit. The text view does resign first responder (the flashing cursor thing in the text box goes away), but the keyboard sometimes won't go away.

What could be causing this problem?

Thank you!

A: 

Declare the UITextViewDelegate protocol

Then implement this

-(BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
 if([text isEqualToString:@"\n"])
{
        [textView resignFirstResponder];
        return NO;
}

    return YES;
}
raaz