|
|
#1 |
|
formatting rich text (fonts, colors) in NSTableView
I have an NSTableView with several entries, and I want to highlight certain words in the table. For example, every time the word "bar" appears in the table, I want that word to be bold and colored red, as in the example line below:
"foobar foo foo bar foo" Any idea how I can accomplish this? Basically, I want to use rich text in the NSTableView cells. I was thinking of using the NSText method replaceCharactersInRange:withRTFD: but I really have no idea if this is correct. I would still need to figure out the RTF syntax, but thats a different story. Please help? Thanks! |
|
|
|
0
|
|
|
#2 |
|
NSAttributedString allows you to add formatting to string objects. Most Cocoa cells and views will respect this when drawing, standard text cells do.
__________________
Sponsor me to cycle 100Km round London in the dark |
|
|
|
0
|
|
|
#3 |
|
Thanks! Once I have formatted a string, can I just use the (NSAttributedString *) instead of the (NSString *) when initializing the NSTableView dictionary?
|
|
|
|
0
|
|
|
#4 | |
|
Quote:
__________________
Sponsor me to cycle 100Km round London in the dark |
||
|
|
0
|
|
|
#5 |
|
I assume you mean the table content, and the answer to that is yes.
|
|
|
|
0
|
|
|
#6 | |
|
Quote:
PHP Code:
|
||
|
|
0
|
|
|
#7 |
|
Easier != better.
Personally, I'd just build the attributed string manually, using initWithString:attributes:, and then combine the different attributed strings together to make the final attributed string (see NSMutableAttributedString). To me, that seems like the right "Cocoa way". |
|
|
|
0
|
![]() |
|
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| thread | Thread Starter | Forum | Replies | Last Post |
| Rich Text Format for emails in iOS5? | applefan289 | iOS 5 and earlier | 3 | Oct 26, 2011 06:05 PM |
| Issue with rich text formatting in Mail.app | Ekim Neems | Mac Applications and Mac App Store | 0 | Jul 26, 2011 08:48 AM |
| NSComboBox in NSTableView behaving strangely | Monaj | Mac Programming | 0 | Jul 4, 2011 10:30 AM |
| Showing text in selected row in NSTableView as white | Monaj | Mac Programming | 1 | Aug 31, 2010 12:14 PM |
| Inserting an image & text in NSTableView | dharma | Mac Programming | 6 | Feb 21, 2006 09:10 AM |
All times are GMT -5. The time now is 09:28 PM.







Linear Mode

