Skip to content

Instantly share code, notes, and snippets.

@0xced
Created April 20, 2010 09:34
Show Gist options
  • Save 0xced/372236 to your computer and use it in GitHub Desktop.
Save 0xced/372236 to your computer and use it in GitHub Desktop.
Automatically show keyboard in MFMailComposeViewController
@try
{
id textView = [mailComposeViewController valueForKeyPath:@"internal.mailComposeView.textView"];
if ([textView respondsToSelector:@selector(becomeFirstResponder)])
[textView becomeFirstResponder];
}
@catch (NSException *e) {}
@haikusw
Copy link

haikusw commented Jul 2, 2011

Cocoanetics says: Just resignFirstResponder on the element that has it before presenting the mail VC

@0xced
Copy link
Author

0xced commented Jul 26, 2011

But does it automatically show the keyboard, without the user tapping the text view?

@haikusw
Copy link

haikusw commented Jul 26, 2011

it should. Setting a UITextField to the first responder does, so I don't see why this wouldn't. I haven't tried this particular case. Obviously it's also getting into undocumented internal stuff, so iffy for those reasons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment