如何在swift中为MFMailComposeViewController中的收件人设置UserInteractionE



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

在这里,我不希望用户编辑to地址。这可能吗?

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

我在StackOverflow中找到了一些旧的参考文献:

如何禁用'to '字段在应用程序内的电子邮件使用MFMailComposeViewController?

如何自定义MFMailComposeViewController,以便我可以使"to"字段不可编辑?

最新更新