objective c - Is there a way to display a different small image (icon) for each row of a NSTableColumn? -


is there way display different small image (icon) each row of nstablecolumn ?

i don't need add new column it, wondering if can add icon in front of text of each row.

i know there method: - (void)setdatacell:(nscell *)acell . method seems use same cell rows, not want.

is there solution problem doesn't require subclass nstablecolumn ? if not, should subclass ?

thanks

make cell column in question nsimagecell. can in interface builder dragging "image cell" object library onto column. select column , you'll able bind image source via 1 of data, value, value path, or valueurl bindings. 1 choose depends on whether source property in model returns nsdata, nsimage, nsstring path, or nsurl url, respectively. see documentation on nsimagecell bindings more complete information.

cells same each row, because they're lightweight class used performance optimization drawing. doesn't mean each row has use cell draw same image though, more text columns' cells have draw same string each row.

if need image in same column text, you'll have more dude explains. off top of head, believe bindings should still possible in case, you'll have write more code make work. rather that, switch using view based nstableview, makes putting multiple views in single column/row easy, , let continue use bindings without work.

edit: dude's answer deleted, summarize, suggested creating custom nscell subclass draw both image , text.


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -