带有文本 url 的 Swift UIAlertController [英] Swift UIAlertController with url in text

查看:31
本文介绍了带有文本 url 的 Swift UIAlertController的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个代码:

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)
    }

我想在此文本后添加:我网站中的更多信息:"+ www - 指向我网站的链接 (http://www.myname.pl).

I would like to add after this text: "More information in my website:" + www - a link to my website (http://www.myname.pl).

我该怎么做?

推荐答案

您无法添加自定义字段,例如带有指向 UIAlertController 的可点击链接的文本视图.您需要创建自己的模态视图控制器,其行为类似于 UIAlertController,或者使用为您执行此操作的第三方框架.

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.

这篇关于带有文本 url 的 Swift UIAlertController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆