Alioo
Alioo

Reputation: 417

Bold and Unbolding the text in a cell in an Objective-C NSTableView with code

This sounds basic, but then again it may not be. I have some text in a cell that I want to go bold when an event happens and unbold when another happens, I know how to handle the event, but how do I make it bold and then unbold it.

Upvotes: 0

Views: 295

Answers (1)

Anne
Anne

Reputation: 27073

Make text bold is specific range:

NSMutableAttributedString *theText = [theTextView textStorage];
[theText applyFontTraits:NSBoldFontMask range:NSMakeRange(0,[text length])];

Optionally how to get the selected range:

NSRange theSelectedRange = [theTextView selectedRange];

Upvotes: 1

Related Questions