UIViewController dismissModalViewControllerAnimated: causes main window to disappear

Posted by Jim on Stack Overflow See other posts from Stack Overflow or by Jim
Published on 2010-04-11T21:30:42Z Indexed on 2010/04/11 21:33 UTC
Read the original article Hit count: 329

I want to present a modal mail dialogue like so in the iPad app:

MFMailComposeViewController* picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;          
[picker setSubject:title];
[picker setMessageBody:[NSString stringWithFormat:[self emailBody], title, [link absoluteString]] isHTML:YES];
[self.viewController presentModalViewController:picker animated:YES];

The following delegate is called when the user sends/cancels:

- (void) mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error { 
    [self.viewController dismissModalViewControllerAnimated:YES];
}

This works great in portrait mode. In landscape mode the right hand pane of the UISplitViewController completely disappears.

© Stack Overflow or respective owner

Related posts about ipad

Related posts about cocoa-touch