Re: figuring out which TableView I am?
Re: figuring out which TableView I am?
- Subject: Re: figuring out which TableView I am?
- From: Michael Ash <email@hidden>
- Date: Mon, 27 Apr 2009 11:23:43 -0400
On Mon, Apr 27, 2009 at 5:10 AM, WT <email@hidden> wrote:
> On Apr 27, 2009, at 6:44 AM, Michael Ash wrote:
>
>> The correct approach here is to define a property, or a set of
>> properties, on your table view subclass to control its appearance,
>> then set up those properties in your controller in awakeFromNib.
>>
>> It is entirely baffling to me that people are so reluctant to follow
>> this approach.
>>
>> The tag approach offers only one advantage: the ability to set the
>> value in IB. And this is an extremely limited advantage when the
>> information available in IB is "3". Give me descriptive code over a
>> "3" any day of the week.
>>
>> Meanwhile it offers enormous disadvantages, including but not limited
>> to extremely opaque code, lack of extensibility, and just general code
>> smell.
>>
>> Define properties for your visual differences, set them up in your
>> controller, and be happy.
>>
>> Mike
>
> With all due respect, I think people have blown the tags solution out of
> proportion, out of a misunderstanding of the OP's needs. The OP simply
> wanted to be able to tell which instance of his subclass of NSTableView he
> was dealing with at any given moment. I suggested the tags solution as a
> means to do so, which I still maintain is a simple and effective solution.
Yes, that idea is fine. I was responding to the much crazier idea of
actually using the tag as a configuration value, not an identifier.
I still think that using the tag to identify the table view is a poor
idea. It is much cleaner and not any harder to simply use an IBOutlet
to each table in order to tell them apart. However using tags for this
instead is not nearly as objectionable.
Mike
_______________________________________________
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