我有一个 WebView ,显示公司的地址、电话号码和电子邮件。当前的行为是,当点击电话号码时,会立即调用。
有没有办法提示警报 View 让用户确认调用?而不是立即调用它?
最佳答案
这是我用来初始化警报的函数:
func displayAlert(title: String, message: String) {
var alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertControllerStyle.Alert)
alert.addAction(UIAlertAction(title: "OK", style: .Default, handler: { (ACTION) -> Void in
// self.dismissViewControllerAnimated(true, completion: nil)
alert.hidesBottomBarWhenPushed = true
}))
print("running Activityindicator code")
self.presentViewController(alert, animated: true, completion: nil)
}
我这样调用它:
self.displayAlert("Alert title", message: "alert message")
希望这有帮助!
关于swift - 使用 Swift 在 Web View 中点击电话号码时显示警报 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32622523/