tags:

views:

52

answers:

1

Is there a way to nest complex views - in particular an NSTokenView - inside each row of an NSTableView or NSOutlineView?

+2  A: 

The quick answer is yes.

Cocoa's user interface elements are implemented as a combination of two parts: a control (a complete subclass of NSView) and a cell (which handles the actual drawing and keyboard/mouse interaction). See Control and Cell Programming Topics for all of the dirty details.

In NSTableView and NSOutlineView, you can specify the cell class that gets used for each NSTableColumn (or even for each individual element, if you want to go that far). You can use NSButtonCell, NSTextFieldCell, and even NSTokenFieldCell.

The documentation on setDataCell: has more of the details.

e.James