Custom NSTableRowView Question
Custom NSTableRowView Question
- Subject: Custom NSTableRowView Question
- From: Luther Baker <email@hidden>
- Date: Mon, 20 Oct 2014 11:08:26 -0500
I've created and I'm displaying a custom NSTableRowView but I'm having
trouble settings its background color.
I tried setting it in the init'r but it is getting overwritten. I can
intercept the calls to [NSTableRowView setBackgroundColor:] and override
the color but before doing that, I'd like to better understand why the
color is being set by something else ... and then maybe work within that
architecture.
With a breakpoint in [NSTableRowView setBackgroundColor:], the stack trace
shows me that if I programmatically invoke: [NSTableView setRowSizeStyle:],
then [NSTableRowData _setBackgroundColorForRowView:] fires on my custom row
view with a color I didn't control.
Additonally, when I programmatically invoke [NSOutlineView expandItem:],
then [NSTableRowData _setBackgroundColorForRowView:] again fires with a
color I didn't set.
The background color doesn't get set when I manually expand rows.
I'm not sure what other methods secretly reset this background color -- but
is there an appropriate way to have the "private" NSTableRowData"
invocations set the correct colors?
As I mentioned, I can obviously implement setBackgroundColor on the custom
table row - but I'm not sure I understand all the possible states I should
account for. expanding? selected? etc ... it feels a little heavy handed.
For what its worth, setting the color as part of the NSOutlineView
delegate's didAddRowView: seems to stick - but since this is a custom row,
I prefer to encapsulate the color management in the custom NSTableRowView
class itself. Maybe I'm thinking wrong ...
Is there an established convention around this?
-Luther
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden