あなたは、あなたのプロジェクトにMessageUI.framework
を含める必要があり、あなたのヘッダファイル内で使用すると、デリゲートを設定する必要があります。
#import <MessageUI/MessageUI.h>
@interface RootViewController : UIViewController <MFMailComposeViewControllerDelegate> {
MFMailComposeViewController *email;
}
@property (nonatomic, retain) MFMailComposeViewController *email;
あなたは、あなたが必要あなたの実装ファイル内のいくつかのデリゲートメソッドをすることを持っていますしたら(あなたは結果を見てチェックする必要がありますが、私は必要なだけの小さなコードを維持しようとしています)を含むように:
:
@synthesize email;
- (void) mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error {
[email dismissModalViewControllerAnimated:YES];
}
あなたがこれを使用したい場合はいつでも、あなたは初期化し、このようにそれを設定する必要があります
email = [[MFMailComposeViewController alloc] init];
email.mailComposeDelegate = self;
// Subject
[email setSubject:@"Testing"];
// Optional Attachments
NSData *artwork = UIImagePNGRepresentation([UIImage imageNamed:@"albumart.png"]);
[email addAttachmentData:artwork mimeType:@"image/png" fileName:@"albumart.png"];
// Body
[email setMessageBody:@"This is the body"];
// Present it
[self presentModalViewController:email animated:YES];
ありがとうございます、これは正しい方向に私を指し、私を始めてください!どうもありがとう。 – bbullis21