Adding a Mail window to a Tab driven window

MFMailComposeViewController can’t be inside a UITabViewController.  It just can’t.  Don’t bother fiddling with auto rotate settings, save yourself heartache and hang it on the tab controller itself instead of one of the sub controllers.  Srsly.

MFMailComposeViewController *tMailer = [[MFMailComposeViewController alloc] init];
tMailer.mailComposeDelegate = self;

[tMailer setSubject:@"Now you know"];

NSString *tEmailBody = [NSString stringWithFormat:@"And knowing is the half of the battle not involving a gun.: <a href=\"%@\">%@</a>", m_OriginalLink, m_ShareLabel];

[tMailer setMessageBody:tEmailBody isHTML:YES];

tMailer.navigationBar.barStyle = UIBarStyleBlack; // choose your style, unfortunately, Translucent colors behave quirky.

//            [self presentModalViewController:picker animated:YES];
WholeAppDelegate *tDelegate = (WholeAppDelegate *)[[UIApplication sharedApplication] delegate];
[tDelegate.m_TabBarController presentModalViewController:tMailer animated:YES];
[picker release];

- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{
WholeAppDelegate*tDelegate = (WholeAppDelegate *)[[UIApplication sharedApplication] delegate];
[tDelegate.m_TabBarController dismissModalViewControllerAnimated:YES];
}

Tags: ,

About Graham Smallwood

My name is Graham Smallwood, and I have over 10 years of programming experience and 6 published million-selling games. I work full time as an iOS developer, and am always looking for contract work to do in my spare time.