Swift 如何添加消息电话通知弹出窗口?l

Swift 如何添加消息电话通知弹出窗口?l,swift,xcode,Swift,Xcode,我想在电话提醒弹出窗口中添加消息。 怎么做 是的,你可以这样做: func phoneCall(to phoneNumber:String) { if let callURL:URL = URL(string: "tel:\(phoneNumber)") { let application:UIApplication = UIApplication.shared if (application.canOpenURL(callURL)) {

我想在电话提醒弹出窗口中添加消息。 怎么做


是的,你可以这样做:

func phoneCall(to phoneNumber:String) {

    if let callURL:URL = URL(string: "tel:\(phoneNumber)") {

        let application:UIApplication = UIApplication.shared

        if (application.canOpenURL(callURL)) {
            let alert = UIAlertController(title: "Your Title", message: "Do you want call that number?", preferredStyle: .alert)
            let callAction = UIAlertAction(title: "Call", style: .default, handler: { (action) in
                application.openURL(callURL)
            })
            let noAction = UIAlertAction(title: "No", style: .cancel, handler: { (action) in
                print("Canceled Call")
            })
            alert.addAction(callAction)
            alert.addAction(noAction)
            self.present(alert, animated: true, completion: nil)
        }
    }
}

是的,你可以这样做:

func phoneCall(to phoneNumber:String) {

    if let callURL:URL = URL(string: "tel:\(phoneNumber)") {

        let application:UIApplication = UIApplication.shared

        if (application.canOpenURL(callURL)) {
            let alert = UIAlertController(title: "Your Title", message: "Do you want call that number?", preferredStyle: .alert)
            let callAction = UIAlertAction(title: "Call", style: .default, handler: { (action) in
                application.openURL(callURL)
            })
            let noAction = UIAlertAction(title: "No", style: .cancel, handler: { (action) in
                print("Canceled Call")
            })
            alert.addAction(callAction)
            alert.addAction(noAction)
            self.present(alert, animated: true, completion: nil)
        }
    }
}

您可以在AlertView中添加子视图您可以在AlertView中添加子视图alertview@TaeHunYu如果是,请批准它作为接受答案这只是弹出2popups@TaeHunYu如果是,请批准它作为接受答案这只是弹出2个弹出窗口