When a button is pressed, the MFMailComposeViewController is presented.
That far I have done.
My question is:
- Is it possible to disable the action sheet popping up when the cancel button is pressed?
- Is it possible to make the to and subject fields non-editable?
- I wanna change the left bar button to back.
How can I do these?
- (IBAction)questionButtonPressed:(id)sender {
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];
}
Yes All Three are possible, however #2 would either require using a private API or some hackery.
I took the approach of subclassing MFMailComposeViewController as below
To use in your code you would change: [[MFMailComposeViewController alloc] init]; to [[CustomMailComposeViewController alloc] init];