我想提出"留下建议"静态单元格打开邮件并允许我使用设置主题撰写邮件。我该如何做到这一点?
修改
import UIKit
import MessageUI
class AccountViewController: UITableViewController, MFMailComposeViewControllerDelegate {
@IBOutlet var Logout: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
@IBAction func emailButtonAction(_ sender: UIButton) {
if MFMailComposeViewController.canSendMail() {
let mail = MFMailComposeViewController()
mail.mailComposeDelegate = self
mail.setToRecipients(["example@gmail.com"])
mail.setSubject("Example Subject")
mail.setMessageBody("<p>Test</p>", isHTML: true)
present(mail, animated: true)
}
}
func mailComposeController(_ controller: MFMailComposeViewController, didFinishWith result: MFMailComposeResult, error: Error?) {
controller.dismiss(animated: true)
}
}
UIButton不能与我的任何单元格一起使用