在同一个viewcontroller上,我们可以发送电子邮件或短信来向朋友发送信息.应用程序中的短信完全有效.但对于电子邮件,电子邮件应用程序在我的应用程序中打开,包含我要求写的所有信息但是不可能通过推送取消来解雇它,没有任何反应.我试过mc.mailComposeDelegate = self或mc.delegate = self,而MFMailComposeViewControllerDelegate也在顶部.我在互联网上看了一切,我没有找到任何解释.永远不会调用mailComposeController!你有什么主意吗 ?
class inviteAFriendViewController: UIViewController, MFMessageComposeViewControllerDelegate, MFMailComposeViewControllerDelegate {
@IBAction func emailButtonDidTouch(sender: AnyObject) {
sendEmail()
}
func sendEmail() {
let emailTitle = "text"
let messageBody = "text"
let toRecipents = [""]
let mc = MFMailComposeViewController()
//mc.mailComposeDelegate = self
mc.delegate = self
mc.setSubject(emailTitle)
mc.setMessageBody(messageBody, isHTML: false)
mc.setToRecipients(toRecipents)
presentViewController(mc, animated: true, completion: nil)
}
func mailComposeController(controller2: MFMailComposeViewController, didFinishWithResult result: MFMailComposeResult, error: NSError?) {
switch result.rawValue {
case MFMailComposeResultCancelled.rawValue:
print("Mail cancelled")
controller2.dismissViewControllerAnimated(true, completion: nil)
case MFMailComposeResultSaved.rawValue:
print("Mail saved")
controller2.dismissViewControllerAnimated(true, completion: …
Run Code Online (Sandbox Code Playgroud) 我一直在寻找快速代码来在视图之间进行简单的自定义幻灯片切换(从左到右或从右到左,没有反弹),但我只找到了复杂动画的代码.谢谢大家的帮助!
奥斯卡