问题
I have this code:
func alertBox(txt: String){
let ac = UIAlertController(title: "MyTtle" , message: "More information in my website: ", preferredStyle: .alert)
let ramkaNaObrazek = CGRect(origin: CGPoint(x: 10, y: 10), size: CGSize(width: 30, height: 30))
let ikonaAlertu = UIImageView(frame: ramkaNaObrazek)
ikonaAlertu.image = UIImage(named: "modal_podpowiedz")
ac.view.addSubview(ikonaAlertu)
ac.addAction(UIAlertAction(title: "Ok" , style: .cancel, handler: { (action: UIAlertAction!) in
}))
present(ac, animated: true)
}
I would like to add after this text: "More information in my website:" + www - a link to my website (http://www.myname.pl).
How can I do this?
回答1:
You can't add custom fields like text views with clickable links to a UIAlertController
. You will need to either create your own modal view controller that acts like a UIAlertController
or use a third party framework that does it for you.
来源:https://stackoverflow.com/questions/49754343/swift-uialertcontroller-with-url-in-text