Re: figuring out which TableView I am?
Re: figuring out which TableView I am?
- Subject: Re: figuring out which TableView I am?
- From: Graham Cox <email@hidden>
- Date: Mon, 27 Apr 2009 10:04:42 +1000
On 27/04/2009, at 9:31 AM, Jim Correia wrote:
I want table 1 to have a blue background, so I set its tag to 3.
I want table 2 to also have a blue background, so I set its tag to 3.
I want table 1 to have red text. Switch off tag, 3 == red text.
I want table 2 to have green text. Oops - tag 3 already means blue
background + red text.
(Substitute any 2 actual properties for my background color + text
color - they are meant for illustration purposes only.)
Overloading tags for other properties is not scalable, because you
only have one property (the tag) which you are overloading to mean N
other properties and/or behaviors.
This is true, but your example of non-scalability does reflect a poor
approach that you wouldn't be likely to follow in practice.
A tag is 32 bits, so can represent 2^32 different states, if used
wisely. Dividing this into bitfields would allow you to partition it
into several properties, for example four different colour properties,
each with 256 possible colours each.
As long as you can specify your needs and know they won't need future
scaling, you can get more out of a tag that just assigning 1, 2, 3 etc
might suggest. The bitfield approach does have the downside of needing
a bit of off-side calculation to arrive at the appropriate 'number'
and this can be somewhat arcane. And yes, they are much less scalable
than ivars. But it's definitely an approach that can be used if your
needs are relatively simple.
--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