In storyboard I can setup a segue from a button to a UIViewController
and make it appear modally. This works fine. However when I change the class in storyboard from UIViewController
to MFMailComposeViewController
, it does not work at all. All that appears is a navigation bar at the top with the rest of the display being filled with black. Am I taking the wrong approach?
I had a similar problem with ABPeoplePickerNavigationController
and I could not seem to figure out what the problem was either. You can either
Fall back to a IBAction
and create the MFMailComposeViewController
instance your self and display it.
If you want to keep using Storyboards, which I think is desirable then you might create a wrapper-class that internally instantiates the MFMailComposeViewController
and then functions as a proxy object and thus propagates viewDid***
and viewWill***
-methods to the wrapped class and also returning the wrapped VC's view in a readonly view
property... You get the idea.
In addition to the answer by Besi:
MFMailComposeViewController
and override initWithCoder:
method.Example:
-(id)initWithCoder:(NSCoder *)aDecoder
{
return [super init];
}
Then it will work with storyboards, but I think your outlets / tags / other definitions from storyboard scene won't be applied (you have to configure mail composer inside your prepareForSegue:sender:
method).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With