Subclassing NSCell
Subclassing NSCell
- Subject: Subclassing NSCell
- From: Ezra Cooper <email@hidden>
- Date: Thu, 4 Dec 2003 15:52:36 -0800
Hi folks,
Looking for some design advice.
What I want to do is to create a table view that for which some cells
expand vertically when the text inside wraps.
Right now, using setWraps: forces the text to wrap around, but the cell
height is fixed (right?) so lines beyond the first one are not visible
(if the font size is small enough, I can see the ascenders of the
second line--that's how I know it's wrapping). This leads me to wonder
why it is possible to wrap text in an NSCell. Is that useful in some
non-table-view context? Or am I missing the magic method that allows a
cell to expand?
The big question is, can I allow the cell to expand just by subclassing
NSCell, or is the same-height-for-all-cells assumption built into the
NSTableView/NSOutlineView logic itself? If so, do I need to write a
whole new NSView?
As part of this problem, I'd like to make sense of the idea that a
single NSCell object is used to render all the cells in a given column
of a NSTableView or NSOutlineView (in this case, I'm focusing on an
outline view). It seems natural that there could be items at different
points in the hierarchy which might need to be displayed in different
ways. So what's behind this design decision? Obviously there's a memory
savings, but the loss of flexibility seems crippling. I suspect I'm
missing something important.
Any explanation of these matters would be appreciated.
Thanks--
Ezra
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.