I have more than one table which will share a certain type of table cell. In 
cell-based table cells, I'd make an NSCell subclass, add whatever needed 
properties there are, and do all the drawing there. The layout of the cell is 
part of the subclass itself.

In view-based tables, I'd create a NSTableCellView subclass and add properties 
and logic there. Since this is view-based, I'd expect to do the cell view's 
layout in a nib rather than code. I expect to be able to create a new nib 
containing the layout for my view, but that's actually not as simple as it 
should be.

Instinctively I expect to be able to create a nib with a view in it with the 
controls and layout I want, and hook them up to the outlets on the cell view, 
and then either specify the nib name in the cell view subclass or use an 
initWithNibName: method to create it. Similar to a view or window controller. 
But you can't actually do this because it's different.

View layout in a nib requires a view exist to add views to, but there's no way 
to say File's Owner is a view and I'm adding these subviews *to* file's owner 
rather than a separate view created during the nib load; So if the File's Owner 
is the cell view instance being created, the nib must contain a "layout" view, 
and then after the nib loads, all of the layout view's subviews have to be 
moved over to the actual cell view. That's possible, but kinda annoying.

Another possible solution is to use a class method on the cell view class which 
does loading from a nib. That method would then have some 
TableCellViewNibLoader class be File's Owner when loading the nib, and then the 
view inside the nib can actually be the table cell view instance which gets 
returned by the method. Possible, but also annoying.


Is there something else I've missed? It seems like the framework should help 
make this easier than it is, though I do recognize this is a different pattern 
of loading and ownership than is the case when a view or window *controller* 
loads a nib.


--
Seth Willits




_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to