Re: view-based nstableview advice
Re: view-based nstableview advice
- Subject: Re: view-based nstableview advice
- From: "Rick C." <email@hidden>
- Date: Tue, 03 Apr 2012 08:10:42 +0800
It's definitely possible I'm mixing things up. :-)
So to create a subclass to further customize the look of my cells beyond the basics I should be subclassing NSTableRowView correct? From what I've seen in the documentation Apple is just dragging a new view onto the table view and setting that view to their subclass right? Since there's no actual NSTableRowView object in IB. But if I don't set its User Interface Item Identifier to NSTableViewRowViewKey the table view will not draw with my subclass. Ok I suppose I could write it in code but I was trying to do it as code-free as possible. Thanks for the help,
rc
On Apr 3, 2012, at 3:24 AM, Uli Kusterer wrote:
> On 02.04.2012, at 08:58, Rick C. wrote:
>> Just trying to make sure I'm on the right track here...so I'm doing my first view-based table view and I do like how I can set a lot of things up in IB like text fields, etc. But I want to customize the rows (give them a gradient, etc.) so am I understanding correctly that I should drag out a custom view in IB onto my table view and set that to a subclass of NSTableRowView, set its identifier to NSTableViewRowViewKey, then do my custom drawing in that subclass? I'm asking because it seems I can do custom drawing in a NSTableCellView subclass as well? Thanks for the pointers,
>
>
> If I understand you correctly, you're mixing things up. The identifier is the reuse identifier. I.e. all cells with the same identifier are considered interchangeable when the table needs a new cell, so if there's an unused cell with the same identifier, it will be used.
>
> Setting the identifier has no effect on the kind of cell class that is created. The cell class is determined by the "Custom Class" of the view in the XIB file, not by its identifier.
>
> You could theoretically use the same class for all your cells, but use different constructors to set up their internals differently based on different reuse identifiers. That's why the identifier is separate from the cell class.
>
> Cheers,
> -- Uli Kusterer
> "The Witnesses of TeachText are everywhere..."
> http://www.lookandfeelcast.com
>
>
>
_______________________________________________
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