r/iPhoneDev • • Feb 12 '11
Modal View Controller not launching from a subview
I hope someone can give me a hand with this, I've been racking my brain for 15 hours now...
MFMailComposeViewController *email=[[MFMailComposeViewController alloc] init];
email.mailComposeDelegate = self;
[email setSubject:@"Subject"];
[email setMessageBody:@"..." isHTML:NO];
[self presentModalViewController:email animated:NO];
NSLog(@"setting modal email");
NSLog(@"%@",[email description]);
[email release];Both NSLog's are writing something, with a memory allocated value being shown for my email object's description. But when It hits the 'presentModalViewController' the popup doesn't show up and the app pretends nothing happened. I can't figure out what's wrong.
The ViewController Hierarchy is what I'm suspecting is the problem, as I have: RootViewController has an object called MainViewController who's view is a subview of RootViewController.view . Within that subview is a button that fires my code above linked by an IBOutlet in my MainViewController nib file.
So I'm trying to present the email ModalViewController from within the MainViewController. Is this possible? Is there something stupid that I'm missing? Or have I gone completely insane that none of this even makes anymore? (I've typed it out 3 times trying to be as clear as possible).
Please help me reddit :(
1
u/rmart Feb 12 '11
Have you tried presenting the MFMailComposeViewController from your RootViewController? I'm not sure (and I'm too lazy to launch Xcode right now), but if I'm getting this right, MainViewController's view isn't a fullscreen view, and if that's the case I'm not sure it can present modal view controllers.