Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keyboard not showing after MFMessageComposeViewController

In an iPhone app I have a UITextView and a button, which lets the user send the content of the UITextView as a text message. The code looks like this:

MFMessageComposeViewController *picker = [[MFMessageComposeViewController alloc] init];
picker.messageComposeDelegate = self;

picker.body = textView.text;

[self presentModalViewController:picker animated:YES];

Everything works fine, except for when the message is either sent or Cancel is tapped in the MFMessageComposer: The keyboard for the UITextView is not shown anymore, even though the cursor blinks.

I tried a few things, including a [textView resignFirstRepsonder] in both the button code and -viewDidDisappear. [textView becomeFirstResponder] in the MFMessageComposeViewControllerDelegate method or the -viewDidAppear didn't change anything either...

Any ideas?

like image 902
fabian789 Avatar asked Dec 06 '25 08:12

fabian789


1 Answers

I had the same issue, and was resigned to accepting fabian's solution, but found that by calling [self dismissModalViewControllerAnimated:NO] and then calling [textView becomeFirstResponder], I was able to make the keyboard reappear. Something about the animation was screwing up the keyboard; looks like a bug in iOS 4.2.

like image 61
chanderson0 Avatar answered Dec 07 '25 21:12

chanderson0



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!