title: Why does this only work sometimes? (UITextView resign first responder question)
body: <p>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...</p>
  
  <p>Why does this code only work SOMETIMES? I need it to work all the time obviously, but it doesn't.</p>
  
  <pre><code>- (void)textViewDidChange:(UITextView *)inTextView {
  
      NSString *text = myTextView.text;
  
      if ([text length] &gt; 0 &amp;&amp; [text characterAtIndex:[text length] -1] == '\n') {
          myTextView.text = [text substringToIndex:[text length] -1];
          [myTextView resignFirstResponder];
          [self sendMessage];
  
      }
  }
  </code></pre>