iPhone, Obj-C, How can I use in app email from an actionsheet button click while using addSubview?

坚强是说给别人听的谎言 提交于 2019-12-02 10:06:06

According to the docs for MFMailComposeViewController:

To display the view managed by this view controller, you can use any of the standard techniques for displaying view controllers. However, the most common way to present this interface is do so modally using the presentModalViewController:animated: method

The first sentence is telling us that you should be showing the view controller for the mail composer in one of the regular ways; adding the view controller's view as a subview to an existing UIView, if that's what you're trying to do, isn't one of the standard ways Apple want you to use, and so might not work or be unpredictable.

Related to this is Apple's advice that a UIViewController should be responsible for showing a whole part of your UI, not just part of it -- which your approach also seems to go against.

So, the solution is to present the mail composer like a normal view controller would be: modally, or pushed onto a nav stack, or presented as the top view under UIWindow, etc.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!