나는 UITable을 가지고 있는데, "Mail"이라는 셀을 클릭하면 sendMailViewController를 push하려고한다. 이 sendMailViewController에서 메일 작성보기를 추가하는 방법?
,있는 viewDidLoad에서 나는 부를 것이다 [자기 displayComposerSheet] :이 이론적으로 이것에 대해 갈 수있는 올바른 방법이 될 것인가?
-(void)displayComposerSheet
{
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[picker setSubject:@"Hello from California!"];
// Set up recipients
NSArray *toRecipients = [NSArray arrayWithObject:@"[email protected]"];
NSArray *ccRecipients = [NSArray arrayWithObjects:@"[email protected]", @"[email protected]", nil];
NSArray *bccRecipients = [NSArray arrayWithObject:@"[email protected]"];
[picker setToRecipients:toRecipients];
[picker setCcRecipients:ccRecipients];
[picker setBccRecipients:bccRecipients];
// Attach an image to the email
NSString *path = [[NSBundle mainBundle] pathForResource:@"rainy" ofType:@"png"];
NSData *myData = [NSData dataWithContentsOfFile:path];
[picker addAttachmentData:myData mimeType:@"image/png" fileName:@"rainy"];
// Fill out the email body text
NSString *emailBody = @"It is raining in sunny California!";
[picker setMessageBody:emailBody isHTML:NO];
[self presentModalViewController:picker animated:YES];
[picker release];
}
위해 무엇을 좋아, 감사, 그래서 IB에서 설정에 아무것도 오른쪽? 그 외의 경우에는'[self launchMailAppOnDevice];를 추가하십시오. 감사. –
사실, 다른 sendMailViewController를 만들 필요가 없습니다. 당신이 가지고있는 것이면 괜찮지 만 - (void) tableView : (UITableView *) 내에서 'displayComposerSheet'를 호출 할 수 있습니다. tableView didSelectRowAtIndexPath : (NSIndexPath *) indexPath {} MFMailComposeViewController가 현재보기 위에 표시되어야합니다. – dredful