jessesquires / JSQMessagesViewController

An elegant messages UI library for iOS
https://www.jessesquires.com/blog/officially-deprecating-jsqmessagesviewcontroller/
Other
11.14k stars 2.81k forks source link

[Customize Cell] Attributed text on message #1882

Closed eironeia closed 8 years ago

eironeia commented 8 years ago

I'm trying to find a way to make the text of the cell attributed to simulate a bubble like whatsapp with senderName inside the bubble attributed with bold and maybe with some color. I've find through all the issues but nothings seems is exactly what I'm finding. Could someone show me how to do it? Or share some code?

I've read that in version 8 this problem will be fixed easy, and will be a easy method to do it, but when version 8 will be released, that's the point.

Lucashuang0802 commented 8 years ago

You should be able to do that by looking at attributedText property from JSQMessagesLabel. Actually, it's from UILabel but JSQMessagesLabel should be the class you work on:

// the underlying attributed string drawn by the label, if set, the label ignores the properties above.
@property(nullable, nonatomic,copy)   NSAttributedString *attributedText NS_AVAILABLE_IOS(6_0);  // default is nil
Lucashuang0802 commented 8 years ago

You should be able to do that by looking at the property attributedText from JSQMessagesLabel. Actually, it's from UILabel but JSQMessagesLabel should be the class you work on:

// the underlying attributed string drawn by the label, if set, the label ignores the properties above.
@property(nullable, nonatomic,copy)   NSAttributedString *attributedText NS_AVAILABLE_IOS(6_0);  // default is nil