@H_502_8@
@H_502_8@@H_502_8@
标签如:用户名评论@H_502_8@
我不知道如何在标签中添加“按钮”;我找到了这个库,但我不确定它会起作用吗? https://github.com/optonaut/ActiveLabel.swift@H_502_8@
也许通过为第一个单词创建一个正则表达式来使用它?你怎么看?@H_502_8@解决方法 对于这种情况,我宁愿使用UITextVIEw,而不是将其添加为UILabel组件,因为它具有 dataDetectorTypes属性:
@H_502_8@
@H_502_8@
The types of data converted to tappable URLs in the text vIEw.@H_502_8@
You can use this property to specify the types of data (phone numbers,
http links,and so on) that should be automatically converted to URLs
in the text vIEw. When tapped,the text vIEw opens the application
responsible for handling the URL type and passes it the URL. Note that
data detection does not occur if the text vIEw’s isEditable property
is set to true.@H_502_8@
因此,您可以将其实现为:@H_502_8@
@H_502_8@
// as mentioned in the documentation,make sure to let it be uneditable:textVIEw.isEditable = falsetextVIEw.dataDetectorTypes = .link
对于你的情况,我认为它应该是.link.我还建议检查UIDataDetectorTypes的其他选项.@H_502_8@ 总结
以上是内存溢出为你收集整理的ios – Swift中标签内的链接全部内容,希望文章能够帮你解决ios – Swift中标签内的链接所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)