Łukasz Betta
Łukasz Betta

Reputation: 161

Swift UIAlertController with url in text

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?

Upvotes: 2

Views: 2205

Answers (1)

Duncan C
Duncan C

Reputation: 131481

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.

Upvotes: 2

Related Questions