小编Swe*_*eta的帖子

使用iPhone上的MessageUI中的MFMailComposeViewController从应用程序发送电子邮件消息

我是一名软件开发人员,我正在为电子邮件制作应用程序,我有以下代码:

// Header file  

// importing the MessageUI framework  
#import <MessageUI/MessageUI.h>  

// adding the delegate functionality to the class (<MFMailComposeViewControllerDelegate>)  
@interface TutorialProjectViewController : UIViewController <MFMailComposeViewControllerDelegate> {  

}  

- (IBAction)pressTheMailButtonDudeFunction:(id)sender

// Implementation file  

- (IBAction)pressTheMailButtonDudeFunction:(id)sender {  

    // allocatind new message composer window  
    MFMailComposeViewController *mc = [[MFMailComposeViewController alloc] init];  

    // setting a delegate method to "self"  
    mc.mailComposeDelegate = self;  

    // pre-populating the message subject  
    [mc setSubject:@"Send me a message"];  

    // adding content of the message as a plain text  
    [mc setMessageBody:@"Send me …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c messageui ipad mfmailcomposeviewcontroller

7
推荐指数
1
解决办法
1万
查看次数