繁体   English   中英

MFMessageComposer取消按钮在iOS 11中不可见

[英]MFMessageComposer cancel button not visible in iOS 11

出现消息撰写器后,右上角的取消按钮在iOS 11设备中不可见。 如屏幕截图所示,“取消”按钮有效,但不可见。 一旦我们按下它,屏幕就会关闭。 在此处输入图片说明

我已经这样尝试过:

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框架,并导入到视图控制器中。

  2. 屏幕截图:

图片 在此处输入图片说明

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM