1

How would I make an NSCell with more than one UI element in it and display it in an NSTableView? For NSCells with a single value I could implement tableView:objectValueForTableColumn:row: but I don't know how to do this for NSCells with more than one. At the moment I have an NSView in an NSCollectionView and all the elements are bound to an NSArrayController. But I'd rather have an NSTableView or similar.

Justin Boo
  • 10,132
  • 8
  • 50
  • 71
Jibo
  • 13
  • 2

2 Answers2

1

I've switched to JAListView for table and outline views in my Mac apps: https://github.com/joshaber/JAListView

It has the advantage of using NSViews for table items instead of NSCells, allowing for greater freedom in implementing your design.

There's a few other alternatives out there too trying to solve similar gaps in NSTableView and its subclasses: http://groups.google.com/group/cocoa-unbound/browse_thread/thread/87b2a1b5725eac05

Dominic
  • 3,304
  • 19
  • 22
0

You return the primary value in the tableView:objectValueForTableColumn:row: method, and then set up the cell further in tableView:willDisplayCell:forTableColumn:row:.

Either that, or you create a custom NSCell subclass that can customize itself based on the objectValue that you give it.

Dave DeLong
  • 242,470
  • 58
  • 448
  • 498
  • If I use the last option, would I need to subclass the NSCell's `objectValue` or only its `setObjectValue:` ? – Jibo Mar 03 '11 at 20:32
  • Nevermind, that was a stupid question. Of course I don't have to. – Jibo Mar 03 '11 at 20:58