I'm trying to open the email view controller (MFMailComposeViewController
), and everything I read suggests using presentModalViewController:animated:
, which seems to need to be sent to a UIViewController
.
For example, in the documentation, it says:
Call the
presentModalViewController:animated:开发者_高级运维
method of the current view controller, passing in the view controller you want to present modally.
But I don't have a "current view controller"! My app is otherwise entirely OpenGL, and my setup code looks like:
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.view = [[IPhoneView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[window addSubview: self.view];
[window makeKeyAndVisible];
and I set up the OpenGL context in the IPhoneView
class.
I've found a number of questions asking how to get a UIViewController
from a UIView
, and the consensus seems to be: don't. So how can I open the email view controller with that nifty sliding animation?
You can always do your own sliding animation of a view and just pass MFMailComposeViewController
to it: Hidden Drawer example
See a similar sliding code here as well: How can I present a UIView from the bottom of the screen like a UIActionSheet?
精彩评论