我在我的项目中使用TTTAttributedLabel。所有我都有一个大文本,我必须在uilabel中显示。在一定数量的线之后,"更多"如果文本被截断,文本应该在那里。所有的东西都工作正常但是当我点击链接时,链接似乎有时会在截断文本之前立即添加到字符中 - 因此点击截断文本不会做任何事情。任何人都可以帮助我,因为我需要尽早解决这个问题。
let truncatedStringColour = [
NSForegroundColorAttributeName: UIColor(red: 142.0/255.0, green: 59.0/255.0, blue: 84.0/255.0, alpha: 1.0),
NSFontAttributeName: UIFont(name: "DINRoundOT", size: 17.0)!,
NSLinkAttributeName : "link"
]
truncatedString = NSAttributedString(string: "...more", attributes: truncatedStringColour)
if let truncatStr = truncatedString {
cell.lblDescription.attributedTruncationToken = truncatStr
}