如何向警报添加网址? [英] How can I add a url to an alert?

查看:67
本文介绍了如何向警报添加网址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种方法可以为查找其他信息的用户添加 url?我的警报看起来像这样

Is there a method to add an url for users looking for additional information? My alert looks like this

let alert = UIAlertController(title: "Alert details", message: "For more detailed information, click the link below", preferredStyle: UIAlertControllerStyle.Alert)
    // add url here
    let okayAction = UIAlertAction(title: "Ok", style: .Default) { (action) in
        print(action)
    }
    alert.addAction(okayAction)

想法是将它们重定向到网页并关闭应用程序中的 UIAlertController

The idea is to redirect them to a webpage and close the UIAlertController in the app

推荐答案

您不能向 UIAlertController 添加任意接口.标题和消息不可点击.您无法添加更多文本.相反,添加另一个按钮 (UIAlertAction) 将它们定向到网页.或者,或者使用其他接口代替 UIAlertController(例如,您可以放置​​一个看起来像警报的呈现视图控制器).

You cannot add arbitrary interface to a UIAlertController. The title and message are not tappable. You cannot add further text. Instead, add another button (UIAlertAction) that directs them to the Web page. Either that, or use some other interface instead of a UIAlertController (for example, you can put up a presented view controller that looks like an alert).

这篇关于如何向警报添加网址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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