我正在使用ContextLabel来解析@,#和URL.这是我发现的最佳解决方案,因为它的尺寸正确并且不会影响性能.它首先在输入处解析字符串,然后将其转换为NSAttributedString和之后将其分配给attributedText属性UILabel.一切都按预期工作,除了尾部截断 - 它是非常不正确的(见下图)
NSAttributedString
attributedText
UILabel
我应该从哪里开始挖掘 - 归因于字符串的属性是错误的吗?还是标签布局问题?谢谢!
nsattributedstring uilabel ios hashtag swift
hashtag ×1
ios ×1
nsattributedstring ×1
swift ×1
uilabel ×1