Skip to content

Instantly share code, notes, and snippets.

@tatetate55
Created March 4, 2016 00:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tatetate55/bcf1145aba131fe710c2 to your computer and use it in GitHub Desktop.
Save tatetate55/bcf1145aba131fe710c2 to your computer and use it in GitHub Desktop.
メール送信objc
- (IBAction)sendButton:(id)sender {
// メールビュー生成
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
// 半角スペースを区切りとして文字列を分割
NSArray *toAddressArray = [self.toAddress.text componentsSeparatedByString:@","];
[picker setToRecipients:toAddressArray];
// 半角スペースを区切りとして文字列を分割
NSArray *ccAddressArray = [self.ccAddress.text componentsSeparatedByString:@","];
[picker setCcRecipients:ccAddressArray];
// メール件名
[picker setSubject:self.titleLabel.text];
// メール本文
[picker setMessageBody:self.mainText.text isHTML:NO];
// メールビュー表示
[self presentViewController:picker animated:YES completion:nil];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment