gpt4 book ai didi

ios - MFMailComposeViewController 在 iOS 8 Xcode 6 中不可编辑

转载 作者:搜寻专家 更新时间:2023-10-31 22:16:48 25 4
gpt4 key购买 nike

我正在使用以下代码来显示电子邮件表。工作表出现了,但我无法编辑主题、正文。我什至不能按取消或发送按钮。这是我的实现:

class PeopleListTableViewController: UITableViewController,SWTableViewCellDelegate,UINavigationControllerDelegate,MFMailComposeViewControllerDelegate, NSXMLParserDelegate {

func showEmailSheet(person :Person) {

if MFMailComposeViewController.canSendMail() {

let mailViewController = MFMailComposeViewController()
mailViewController.mailComposeDelegate = self

mailViewController.setToRecipients([person.email!])

self.presentViewController(mailViewController, animated: true, completion: nil)

}
}

我做错了什么?

最佳答案

这是我的一个项目的工作代码。请务必在 iOS 设备上使用表单,而不是在模拟器中。

import UIKit
import MessageUI

class ViewController: UIViewController, MFMailComposeViewControllerDelegate {
@IBAction func launchEmail(sender: AnyObject) {

var emailTitle = "Feedback"
var messageBody = "Feature request or bug report?"
var toRecipents = ["youraddress@gmail.com"]
var mc: MFMailComposeViewController = MFMailComposeViewController()
mc.mailComposeDelegate = self
mc.setSubject(emailTitle)
mc.setMessageBody(messageBody, isHTML: false)
mc.setToRecipients(toRecipents)

self.presentViewController(mc, animated: true, completion: nil)
}

func mailComposeController(controller:MFMailComposeViewController, didFinishWithResult result:MFMailComposeResult, error:NSError) {
switch result.value {
case MFMailComposeResultCancelled.value:
println("Mail cancelled")
case MFMailComposeResultSaved.value:
println("Mail saved")
case MFMailComposeResultSent.value:
println("Mail sent")
case MFMailComposeResultFailed.value:
println("Mail sent failure: %@", [error.localizedDescription])
default:
break
}
self.dismissViewControllerAnimated(true, completion: nil)
}
}

关于ios - MFMailComposeViewController 在 iOS 8 Xcode 6 中不可编辑,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26199643/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com