You can look inside the view of the mailComposer object:
UIView *v0 = mailComposer.view; UIView *v1 = [[v0 subviews] objectAtIndex:0]; // UINavigationTransitionView UIView *v2 = [[v1 subviews] objectAtIndex:0]; // UIViewControllerWrapperView UIView *v3 = [[v2 subviews] objectAtIndex:0]; // MFMailComposeView UIView *v4 = [[v3 subviews] objectAtIndex:0]; // UIView UIView *v5 = [[v4 subviews] objectAtIndex:0]; // MFComposeScrollView UIView *v6 = [[v5 subviews] objectAtIndex:0]; // UIView UIView *v7 = [[v6 subviews] objectAtIndex:0]; // MFMailComposeRecipientView UIView *v8 = [[v7 subviews] objectAtIndex:1]; // _MFMailRecipientTextField
This v8 guy is the one you want. This is a subclass of UITextField. Make him the first responder.
Officially, you should check the types of subitems instead of the first or second object. But then again, officially, you should not do this at all, as this is all undocumented and could be broken in future versions of iOS.
source share