如何在swift中的MFMailComposeViewController中为Recepients设置UserInteractionEnabled为false

时间:2015-09-17 03:23:42

标签: ios swift mfmailcomposer

我正在使用MFMailComposeViewController从我的应用程序发送反馈。

func configuredMailComposeViewController() -> MFMailComposeViewController {

    let mailComposerVC = MFMailComposeViewController()

    mailComposerVC.mailComposeDelegate = self // Extremely important to set the --mailComposeDelegate-- property, NOT the --delegate-- property
    mailComposerVC.setToRecipients(["info@myCompany.com"])
    mailComposerVC.setSubject("Subject")
    mailComposerVC.setMessageBody("Body", isHTML: false)

    return mailComposerVC
}

在此,我不希望用户编辑收件人地址。这可能吗?

1 个答案:

答案 0 :(得分:2)

不幸的是,这是不可能的。这个小API不允许这样做。

我在StackOverflow中发现了一些旧的引用也在谈论它:

How to disable the 'To' field in an In-App email using MFMailComposeViewController?

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