簡體   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