MFMessageComposer取消按钮在iOS 11中不可见 [英] MFMessageComposer cancel button not visible in iOS 11

查看:161
本文介绍了MFMessageComposer取消按钮在iOS 11中不可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在显示消息撰写器后,右上角的取消"按钮在iOS 11设备中不可见.如屏幕截图所示,取消"按钮有效,但不可见.一旦按下它,屏幕就会关闭.

The cancel button on right top corner after a message composer has been presented is not visible in iOS 11 devices. As shown in the screenshot, cancel button works but is not visible. Once we press on it, the screen dismisses.

推荐答案

我已经尝试过:

class ViewController: UIViewController, MFMessageComposeViewControllerDelegate {

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}


@IBAction func Messages(_ sender: UIButton) {
    if MFMessageComposeViewController.canSendText() == true {
        let recipients:[String] = ["1500"]
        let messageController = MFMessageComposeViewController()
        messageController.messageComposeDelegate  = self
        messageController.recipients = recipients
        messageController.body = "Your_text"
        self.present(messageController, animated: true, completion: nil)
    } else {
        //handle text messaging not available
    }
}

func messageComposeViewController(_ controller: MFMessageComposeViewController, didFinishWith result: MessageComposeResult) {
    controller.dismiss(animated: true, completion: nil)
}
    
}

  1. 添加了MessagesMessageUI框架并导入到视图控制器中.

  1. Added Messages and MessageUI frameworks and imported in view controller.

屏幕截图:

图片:

这篇关于MFMessageComposer取消按钮在iOS 11中不可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆