我想在我的应用程序上创建一个可点击的标签,引导我进入Safari网页。我也希望用户能够拨打电话的号码只通过点击他们?
谢谢你的建议
发布于 2018-03-02 00:59:29
使用UIButton的Swift 4.0可能的解决方案
phoneButton = UIButton(frame: CGRect(x: view.frame.width * 0, y: view.frame.height * 0.1, width: view.frame.width * 1, height: view.frame.height * 0.05))
phoneButton.setTitle("333-333-3333", for: .normal )
phoneButton.setTitleColor(UIColor(red: 0 / 255, green: 0 / 255, blue: 238 / 255, alpha: 1.0), for: .normal)
phoneButton.addTarget(self, action: #selector(self.callPhone), for: .touchUpInside )
@objc func callPhone(){
UIApplication.shared.open(URL(string:"tel://3333333333")!, options: [:] , completionHandler: nil)
}https://stackoverflow.com/questions/10681965
复制相似问题