有没有办法为寻找更多信息的用户添加 url?我的警报看起来像这样
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
最佳答案
您不能向 UIAlertController 添加任意接口(interface)。标题和消息不可点击。您无法添加更多文本。相反,添加另一个按钮 (UIAlertAction) 将它们引导至网页。或者,或者使用其他一些接口(interface)而不是 UIAlertController(例如,您可以放置一个呈现的 View Controller ,它看起来像一个警报)。
关于swift - 如何将 url 添加到警报?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39438417/