简体   繁体   中英

Set “To:” field as first responder in MFMailComposeViewController

Does anyone have any ideas on the right way to do this? There is one answer to a similar question on here, but it's so convoluted, I can't imagine it being right. There has to be an easier way to just show the keyboard when this modal view pops up. right?

MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;

[picker setSubject:@"Mail subject"];
[picker setToRecipients:[NSArray arrayWithObjects:@"email@email.com",nil]];

Also wanted to know how and found this which works: Set First Responder in MFMailComposeViewController? NB my comment about using MFRecipientTextField rather than RecipientTextField Not sure if Apple will reject for App Store, but worth a try!*

*Update - Apple approved my app, so looks like it's fine to use (at least for now!)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM