Is there a way to nest complex views - in particular an NSTokenView 开发者_运维技巧- inside each row of an NSTableView or NSOutlineView?
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.
精彩评论