在tableviewcontroller中创建静态单元格,在按下时调出组合邮件

时间:2018-02-02 03:25:56

标签: ios swift xcode uitableview static-content

enter image description here

我想提出"留下建议"静态单元格打开邮件并允许我使用设置主题撰写邮件。我该如何做到这一点?

修改

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不能与我的任何单元格一起使用

0 个答案:

没有答案