Aditya
Aditya

Reputation: 115

TTTAttributedLabel Truncation Text Issue

I am using TTTAttributedLabel in my Project. All i have a large text which i have to show in uilabel. After certain number of lines, "more" text should be there if text get truncated. All things are working fine but when i am clicking on the link,the link seems to be added to the characters immediate before the truncation text at times - so tapping on the truncation text doesn't do anything. Can anyone please help me as i need this to be solve as early as possible.

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
}

Upvotes: 4

Views: 1972

Answers (1)

Mtoklitz113
Mtoklitz113

Reputation: 3878

Docs say:

TTTAttributedLabel can display both plain and attributed text: just pass an NSString or NSAttributedString to the setText: setter. Never assign to the attributedText property.

To resolve, set the label's text property instead of the attributed Text property.

Check this answer

You can use this to help you more.

Upvotes: 0

Related Questions