开发者

How to email the contents of a view

开发者 https://www.devze.com 2023-03-31 16:34 出处:网络
I have a view with a few text boxes and labels. I\'d like to email the view containing this information to either a contact list or just a text box with an email address in it.

I have a view with a few text boxes and labels. I'd like to email the view containing this information to either a contact list or just a text box with an email address in it.

I can't get the view to email. I'd lik开发者_如何转开发e to send the whole page without having to somehow list every text box. How do I email the view with this code:

[controller setMessageBody:textBoxesAndInfo isHTML:YES];


-(IBAction)sendMail {

    // create an instance of MFMailComposeViewController for sending an e-mail
    MFMailComposeViewController *controller =     
    [[MFMailComposeViewController alloc] init];

    // set controller's delegate to this object
    controller.mailComposeDelegate = self;

    [controller setToRecipients:@[@"hello@example.com"]];
    [controller setSubject:@"Subject"];
    [controller setMessageBody:textBoxesAndInfo isHTML:YES];

    // show the MFMailComposeViewController
    [self presentModalViewController:controller animated:YES];

}

// called when the user finishes sending an e-mail
- (void)mailComposeController:(MFMailComposeViewController*)controller
      didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error {

    [self dismissModalViewControllerAnimated:YES];

}

Remember to include the MessageUI framework.

0

精彩评论

暂无评论...
验证码 换一张
取 消