NSOutlineView: what does this even mean?
NSOutlineView: what does this even mean?
- Subject: NSOutlineView: what does this even mean?
- From: Graham Cox <email@hidden>
- Date: Thu, 22 May 2014 14:15:31 +1000
According to the documentation:
xcdoc://?url=developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSTableView_Class/Reference/Reference.html#
Specifying a Custom Row View In a NIB
The NSTableViewRowViewKey is the key that NSView-based table view instances use to identify the NIB containing the template row view. You can specify a custom row view (without any code) by associating this key with the appropriate NIB name in Interface Builder.
NSString *const NSTableViewRowViewKey;
So I want to use a custom subclass of NSTableRowView so I can use an in-house UI highlighting style. It's far from obvious how to do this, even though other documentation states that this is the 'correct' approach to customising the row highlight of a view-based table. The docs only have the text above, providing a glimmer of hope.
I assumed this referred to adding an entry in the 'user-defined key paths' section of the table (outline) view, with NSTableViewRowViewKey and the name of the nib file containing the row view as the value. But that doesn't work, and throws an exception:
22/05/2014 2:00:25.616 pm <app>[12316]: [<NSOutlineView 0x10200d7a0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key NSTableViewRowViewKey.
Well duh, of course it isn't. But if this isn't what the docs mean, what *DO* they mean? I can see no other place to enter the nib identifier in the outline view in IB. *Where* does this key go?
<rant>why is this so complicated anyway? A simple outlet to a template view would be simple and straightforward; leave it unconnected for the standard row view. Or at least provide a place to enter the class name of the row view subclass. This whole business of indirectly referencing a second nib seems like stupid to me.</rant>
That's not the whole of the problem either, since the referenced nib's structure is unclear from the docs. How can we tell the outline view *which* view in the nib to use? Must it be the only object in that nib? Nobody knows. I'm getting pretty frustrated with what really ought to be straightforward.
--Graham
_______________________________________________
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