When a user presses the "SEND"(return) button I want the keyboard to retract and do other stuff like send a message. But it only works SOMETIMES...
Why does this code only work SOMETIMES? I need it to work all the time obviously, but it doesn't.
- (void)textViewDidChange:(UITextView *)inTextView {
NSString *text = myTextView.text;
if ([text length] > 0 && [text characterAtIndex:[text length] -1] == '\n') {
myTextView.text = [text substringToIndex:[text length] -1];
[myTextView resignFirstResponder];
[self sendMessage];
}
}