如何将可触摸的 Url 链接添加到 UIAlertView 消息中的 url?
我想将一个可点击的网址链接添加到 UIAlertView
的消息中。 这样,当用户看到警报视图时,他们可以触摸消息内的链接。或者,他们可以单击“确定”按钮继续下一步。
有可能做到吗?如何?
I want to add a clickable link of an url into UIAlertView
's message.
Such that when user sees the alert view, they can can touch on link inside message. Alternatively they can go next by clicking on the OK button.
Is possible to do it? How?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为实现您想要的唯一方法是通过自定义警报视图。
您可以采取多种方法。一种是 UIAlertView 的子类化,在这里您可以找到一个简短的教程:子类 UIAlertView。然后,您可以在您的子类中以任何您喜欢的方式构建警报来实现支持触摸的文本。查看本教程一种方法来做到这一点。
The only way I see to implement what you are trying to is through a custom alert view.
There are several approaches that you can take. One is subclassing UIAlertView and here you can find a short tutorial: Subclass UIAlertView. In your subclass you could then build the alert any way you like to implement the touch-enabled text. Have a look at this tutorial for a way to do it.
我今天遇到了这个问题,我需要在警报视图中包含可点击的电话号码和地址,并且由于自定义警报视图无法实现而被难住了很长一段时间。
经过一番研究后,您似乎可以将文本视图添加到警报视图中,这似乎解决了我的问题。这是我的方法,允许动态缩放警报视图(注意:将
C#
与 Xamarin 结合使用):I ran into this problem today, I needed to have clickable phone numbers and addresses in my alert view and was stumped for quite awhile as custom alert views are out of the question.
After some research it seems that you can add a textview to an alertview which seemed to solve my problem. Here is my approach that allows for dynamically scaling alertviews (note: using
C#
with Xamarin):