NSOutlineview with images in cells
I'd like to add images next to my cells in my nsoutlineview.
I'm having a really tough time doing this. I'm coming from iPhone development, so I was thinking of making a custom cell to do this, but it seems like NSCell is a control, not a view.
I've looked at the SourceView sample code, but it's tremendously confusing. It seems like this should be a really simple task as it's such a common int开发者_如何学JAVAerface component.
I currently have a working nsoutlineview which only has text, and i've implemented the following delegate methods:
-outlineView:child:ofItem:
-outlineView:isItemExpandable:
-outlineView:numberOfChildrenOfItem:
-outlineView:objectValueForTableColumn:byItem:
-outlineView:setObjectValue:forTableColumn:byItem:
-outlineViewSelectionDidChange:
Check out PXSourceList. It does this (using custo drawing), so you can either just use it directly or rip the drawing code into your own app, etc.
Apple has an example on how to do this:
http://www.cocoadev.com/index.pl?NSTableViewImagesAndText
精彩评论