3

メール本文の各項目にチェックボックスを追加したいのですが、ここにいくつかのテストコードがあります

        [mailPicker setMessageBody:@"<html>\
         <head>\
         <title> Insert title here </title>\
         <body> Insert the body of email here </body>.\
         <form>\
         <input type=\"checkbox\" /> I am a male <br />\
         <input type=\"checkbox\" /> I am a female\
         </form>\
         </html>" isHTML:YES];

MFMailComposeViewControllerを提示するとチェックボックスが表示されるのですが、mail.appでこのメールを受信するとチェックボックスが一切表示されません。

見逃したものはありますか?

ありがとう。

4

1 に答える 1

1

ここにあなたのための解決策があります:

MFMailComposeViewController *mailController = [[MFMailComposeViewController alloc] init];
mailController.mailComposeDelegate = self;
NSString *emailBody = @"<p>Here Your HTML Code</p>";                         
[mailController setMessageBody:emailBody isHTML:YES]; 
[self mailController animated:YES completion:NO];

デリゲートを実装する

- (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0)
{
// Notifies users about errors associated with the interface

switch (result)

{
    case MFMailComposeResultCancelled:

        // message.text = @"Result: canceled";

        break;

    case MFMailComposeResultSaved:

        // message.text = @"Result: saved";

        break;

    case MFMailComposeResultSent:

        //   message.text = @"Result: sent";

        break;

    case MFMailComposeResultFailed:

        // message.text = @"Result: failed";

        break;

    default:

        //  message.text = @"Result: not sent";

        break;

}

[self dismissViewControllerAnimated:YES completion:NO];
}
于 2013-03-08T10:02:44.930 に答える