How to customize MFMailComposeViewController so that i can make the “to” field as non-editable?

為{幸葍}努か 提交于 2019-11-28 12:33:29

You can not customize MFMailComposeViewController to avoid editing. Apple forbids this, and the reason is quite simple: it is the user and not you that must decide exactly what to send, to whom etc. The same applies for the UI controller allowing to send SMS (text) messages. And, of course, Apple does not allows sending an email or SMS without explicit interaction with the user. It is the user that must validate and send the email or SMS message. The validation process include the ability to cancel the message or to change any single property at will, including the "to" recipients.

All the other answers are correct. You can not change the interface of the MFMailComposeViewController. But you have other possibilities. ;-)

Three20 SDK includes also an Mail Composer. Try it out. I think it should be that far changeable, that the "to" field is not editable anymore.

I hope my answer is helpful for you.

Sandro Meier

EDIT

Three20 SDK was discontinued a while ago. So you shouldn't use it anymore for new projects. I advise you to use NimbusKit instead. This is also recommended by the Three20 SDK team. Sadly it does not include a MailComposeViewController

From the Apple documentation:

Important: The mail composition interface itself is not customizable and must not be modified by your application. In addition, after presenting the interface, your application is not allowed to make further changes to the email content. The user may still edit the content using the interface, but programmatic changes are ignored. Thus, you must set the values of content fields before presenting the interface.

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