views:

313

answers:

2

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.

A: 

You can only present these from the primary view of your application. In this case, presenting from the UISplitViewController works.

Jim
A: 

I have the same problem, did you managed to solve the issue?

Yes. You need to call [UIViewController presentModalViewController:animated:] from the main view controller, which for this app was the UISplitViewController.
Jim