MFMailComposeViewControllerを試してみてください....ここではいくつかのサンプルコードです: はあなたがMEssageUIフレームワークをインポートしていることを確認してくださいとの.hにMFMailComposeViewController/MessageUIをインポートしても、そのデリゲートに準拠
MFMailComposeViewController *mailView = [[MFMailComposeViewController alloc] init];
[mailView setMailComposeDelegate:self];
if ([MFMailComposeViewController canSendMail]) {
[mailView setSubject:@"Interesting Apple News Article!"];
NSString *mailString = [[NSString alloc] initWithFormat:@"Test!"];
[mailView setMessageBody:mailString isHTML:NO];
[mailView setModalTransitionStyle:UIModalTransitionStyleCoverVertical];
[self presentModalViewController:mailView animated:YES];
[mailString release];
[mailView release];
} else
[mailView release];
}
-(void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error {
if (error) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Mailing Error" message:[error localizedDescription] delegate:self cancelButtonTitle:@"Dismiss" otherButtonTitles:nil, nil];
[alert show];
[alert release];
[self dismissModalViewControllerAnimated:YES];
} else {
[self dismissModalViewControllerAnimated:YES];
}
}
[MFMailComposeViewController documentation](http://developer.apple.com/library/ios/DOCUMENTATION/MessageUI/Reference/MFMailComposeViewController_class/Reference/Reference.html)を見ましたか?メール側の作業のほとんどはあなたのために行われるためです。 – CodaFi
お返事ありがとうございます。私はメール側のコードを持っているが、それを私のアプリに統合するのには苦労している。 Cannnotはメールコードの呼び出し方法を理解しています。変数の値がゼロに設定されている場合は、メールコードをトリガーする必要があります。 MFMailを呼び出す方法がわかりません...プロトコルを使用する必要がありますか?はいの場合は、代理人を設定する方法を知らない... – user1367079