iOS - UITextView becomeFirstResponder

Andrea Mario Lufino picture Andrea Mario Lufino · Nov 25, 2011 · Viewed 9.2k times · Source

This is the problem : when MessageComposeViewController has been dismissed, my textView doesn't become the first responder and the keyboard doesn't appear. Why? I put the [textView becomeFirstResponder] code in viewWillAppear. How can i do??

Answer

jeswang picture jeswang · Aug 2, 2012

I called becomeFirstResponder later by this line:

[self.searchBar performSelector:@selector(becomeFirstResponder) withObject:nil afterDelay:0.1f];

It worked for me. Hope this help.

I guess it's the animation's reason.