2011-08-30 100 views
0

我有幾個文本框和標籤的視圖。我想將包含此信息的視圖通過電子郵件發送給聯繫人列表或僅包含電子郵件地址的文本框。如何通過電子郵件發送視圖的內容

我無法看到電子郵件。我想發送整個頁面而無需以某種方式列出每個文本框。如何通過電子郵件發送使用此代碼的觀點:

[controller setMessageBody:textBoxesAndInfo isHTML:YES]; 

回答

6
-(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:@[@"[email protected]"]]; 
    [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]; 

} 

請記住,包括MessageUI框架。

+1

看起來像一個'命中註定'。無論如何,無論如何我都會得到一個正確答案。 –