如何在 swift 中为 MFMailComposeViewController 中的收件人将 UserInteractionEnabled 设置为 false

How to set UserInteractionEnabled to false for recepients in MFMailComposeViewController in swift

我正在使用 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
}

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

很遗憾,这是不可能的。这么小的API不允许做。

我在 Whosebug 中发现了一些旧的参考资料也在谈论它:

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?