Re: view-based nstableview advice
Re: view-based nstableview advice
- Subject: Re: view-based nstableview advice
- From: Uli Kusterer <email@hidden>
- Date: Mon, 02 Apr 2012 21:24:47 +0200
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