{"id":583,"date":"2018-02-23T23:40:12","date_gmt":"2018-02-23T15:40:12","guid":{"rendered":"http:\/\/60.205.208.74\/2018\/02\/23\/ios%e5%8f%91%e9%80%81%e7%94%b5%e5%ad%90%e9%82%ae%e4%bb%b6\/"},"modified":"2018-02-23T23:40:12","modified_gmt":"2018-02-23T15:40:12","slug":"ios%e5%8f%91%e9%80%81%e7%94%b5%e5%ad%90%e9%82%ae%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/www.puzi7.net\/?p=583","title":{"rendered":"iOS\u53d1\u9001\u7535\u5b50\u90ae\u4ef6"},"content":{"rendered":"<span itemprop=\"description\"><div class=\"article-body\">\n<div class=\"article-intro\" id=\"content\">\n<h1>IOS\u53d1\u9001\u7535\u5b50\u90ae\u4ef6<\/h1>\n<hr>\n<h2>\u7b80\u4ecb<\/h2>\n<p>\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528IOS\u8bbe\u5907\u4e2d\u7684\u7535\u5b50\u90ae\u4ef6\u5e94\u7528\u7a0b\u5e8f\u53d1\u9001\u7535\u5b50\u90ae\u4ef6\u3002<\/p>\n<h3>\u5b9e\u4f8b\u6b65\u9aa4<\/h3>\n<p>1\u3001\u521b\u5efa\u4e00\u4e2a\u7b80\u5355\u7684View based application<\/p>\n<p>2\u3001\u9009\u62e9\u9879\u76ee\u6587\u4ef6\uff0c\u7136\u540e\u9009\u62e9\u76ee\u6807\uff0c\u7136\u540e\u6dfb\u52a0MessageUI.framework<\/p>\n<p>3\u3001\u5728ViewController.xib\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u6309\u94ae\uff0c\u521b\u5efa\u7528\u4e8e\u53d1\u9001\u7535\u5b50\u90ae\u4ef6\u7684\u64cd\u4f5c\uff08action\uff09<\/p>\n<p>4\u3001\u66f4\u65b0ViewController.h,\u5982\u4e0b\u6240\u793a<\/p>\n<pre>\n#import &lt;UIKit\/UIKit.h&gt;\n#import &lt;MessageUI\/MessageUI.h&gt;\n\n@interface ViewController : UIViewController&lt;MFMailComposeViewControllerDelegate&gt;\n{\n    MFMailComposeViewController *mailComposer;\n}\n\n-(IBAction)sendMail:(id)sender;\n\n@end\n<\/pre>\n<p>5\u3001\u5982\u4e0b\u6240\u793a\uff0c\u66f4\u65b0ViewController.m<\/p>\n<pre>\n#import \"ViewController.h\"\n\n@interface ViewController ()\n\n@end\n\n@implementation ViewController\n\n- (void)viewDidLoad\n{\n    [super viewDidLoad];   \n}\n\n- (void)didReceiveMemoryWarning\n{\n    [super didReceiveMemoryWarning];\n    \/\/ Dispose of any resources that can be recreated.\n}\n\n-(void)sendMail:(id)sender{\n    mailComposer = [[MFMailComposeViewController alloc]init];\n    mailComposer.mailComposeDelegate = self;\n    [mailComposer setSubject:@\"Test mail\"];\n    [mailComposer setMessageBody:@\"Testing message \n    for the test mail\" isHTML:NO];\n    [self presentModalViewController:mailComposer animated:YES];\n}\n\n#pragma mark - mail compose delegate\n-(void)mailComposeController:(MFMailComposeViewController *)controller \n didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error{\n   if (result) {\n        NSLog(@\"Result : %d\",result);\n    }\n    if (error) {\n        NSLog(@\"Error : %@\",error);\n    }\n    [self dismissModalViewControllerAnimated:YES];\n\n}\n\n@end\n<\/pre>\n<h3>\u8f93\u51fa<\/h3>\n<p>\u5f53\u8fd0\u884c\u8be5\u5e94\u7528\u7a0b\u5e8f\uff0c\u4f1a\u770b\u5982\u4e0b\u7684\u8f93\u51fa\u7ed3\u679c<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"attachment-full\" alt=\"sendEmailOutput1\" src=\"http:\/\/www.runoob.com\/wp-content\/uploads\/2013\/11\/sendEmailOutput1.jpg\" width=\"250\" height=\"491\" data-pinit=\"registered\"><\/p>\n<p>\u5f53\u70b9\u51fb&#8221;send email&#8221;\u53d1\u9001\u6309\u94ae\u540e\uff0c\u53ef\u4ee5\u770b\u5230\u5982\u4e0b\u7ed3\u679c\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"attachment-full\" alt=\"sendEmailOutput2\" src=\"http:\/\/www.runoob.com\/wp-content\/uploads\/2013\/11\/sendEmailOutput2.jpg\" width=\"250\" height=\"495\" data-pinit=\"registered\"><\/p>\n<\/p><\/div>\n<\/p><\/div>\n<span>","protected":false},"excerpt":{"rendered":"<p class=\"excerpt\"><span itemprop=\"description\">IOS\u53d1\u9001\u7535\u5b50\u90ae\u4ef6 \u7b80\u4ecb \u6211\u4eec\u53ef\u4ee5\u4f7f\u7528IOS\u8bbe\u5907\u4e2d\u7684\u7535\u5b50\u90ae\u4ef6\u5e94\u7528\u7a0b\u5e8f\u53d1\u9001\u7535\u5b50\u90ae\u4ef6\u3002 \u5b9e\u4f8b\u6b65&hellip;<\/span><\/p>\n<p class=\"more-link-p btn-align-right\"><a class=\"green zoom-btn\" href=\"https:\/\/www.puzi7.net\/?p=583\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[38,26],"tags":[74,93],"class_list":["post-583","post","type-post","status-publish","format-standard","hentry","category-ios","category-mobile","tag-ios","tag-mobile","zoom-theme-has-thumb"],"_links":{"self":[{"href":"https:\/\/www.puzi7.net\/index.php?rest_route=\/wp\/v2\/posts\/583","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.puzi7.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.puzi7.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.puzi7.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.puzi7.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=583"}],"version-history":[{"count":0,"href":"https:\/\/www.puzi7.net\/index.php?rest_route=\/wp\/v2\/posts\/583\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.puzi7.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=583"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.puzi7.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=583"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.puzi7.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=583"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}