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

前端 未结 1 1840
一个人的身影
一个人的身影 2021-01-28 04:05

I found some great example code some months ago to add a compose button to a view to allows emails to be sent within an app...

http://blog.mugunthkumar.com/coding/iphone

相关标签:
1条回答
  • 2021-01-28 04:40

    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.

    0 讨论(0)
提交回复
热议问题