2
votes

From a tableview I want to present a MFMailComposeViewController. I don't want to use the presentModalViewController:animated: method, but instead push the view controller, so it's consistent with the other animations from this table view.

Because MFMailComposeViewController is a UINavigationController and pushing a navigation controller is not supported, I used:

[[self navigationController] pushViewController:[mailComposer topViewController] animated:YES];

This works, but when I tap the Cancel button it gives the warning:

Presenting action sheet clipped by its superview. Some controls might not respond to touches. On iPhone try -[UIActionSheet showFromTabBar:] or -[UIActionSheet showFromToolbar:] instead of -[UIActionSheet showInView:].

The Cancel button at the bottom of the UIActionSheet doesn't respond to touches. Does anyone know whether it is possible to push a MFMailComposeViewController?

1
You already answer your question - MFMailComposeViewController is a UINavigationController and pushing a navigation controller is not supportedberyllium
But you can push MFMailComposeViewController's UIViewController. Or is this not supported?Marco
You code pushes UIViewController (topViewController returns it). It's a normal behavior.beryllium
Yes I know, but downside is the UIActionSheet warning when you use the MailComposer's cancel button. So it doesn't seem supported or I'm missing a step (like telling this view controller to use [self navigationController] as it's navigationController).Marco
I think this UIActionSheet called from navigation which contains MailComposer and this action sheet cann't find (or do) something because you have only part of navigation hierarchy (missing navigationBar or toolBar).beryllium

1 Answers

5
votes

Presenting a MFMailComposeViewController as a modal view is consistent with Apple's HIG. Pushing it onto a navigation stack is not. Use -presentModalViewController:animated: (or -presentViewController:animated:completion: if executing on iOS 5 or greater)