How to hide setToComposer in MFMailComposeViewControllerDelegate?
This View with the in-app email client shows the name of the individual being emailed. I would like the user to not be able to see who they will be emailing.
-(IBAction)email {
MFMailComposeViewController *composer = [[MFMailComposeViewController alloc] init];
[composer setMailComposeDelegate:self];
if ([MFMailComposeViewController canSendMail]) {
[composer setToRecipients:[NSArray arrayWithObjects:@"sam开发者_如何转开发ple@gmail.com", nil]];
[composer setSubject:@"Subject"];
[composer setMessageBody:@"message here" isHTML:NO];
[composer setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self presentModalViewController:composer animated:YES];
[composer release];
}
else
[composer release];
}
-(void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error {
if (error) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"error"
message:[NSString stringWithFormat:@"error %@", [error description]]
delegate:nil cancelButtonTitle:@"dismiss" otherButtonTitles:nil, nil];
[alert show];
[alert release];
[self dismissModalViewControllerAnimated:YES];
}
else {
[self dismissModalViewControllerAnimated:YES];
}
}
To do that you'd need to code up a custom view with the email sending functionality.
As @seppo0010 said, you cannot do that. Apple created a specific user interface that MFMailComposeViewController uses. As such, if you use MFMailComposeViewController, you cannot modify what the view looks like.
Your alternative is to use some other message viewController
that you would have to create yourself. Create a viewController
and than transmit the data from the message to your own server or where ever else you want it sent. I tried to create one myself, but I completely underestimated the amount of work it involved.
If you plan on looking for a pre-made solution, I have seem some open source examples that claim to do this, but I've never gotten one to work.
My advice would be to just stick with what Apple provides.
That's not possible. If you intent to use MFMailComposeViewController, the user will be able to see the recipients.
精彩评论