• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: figuring out which TableView I am?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: figuring out which TableView I am?
      • From: Michael Ash <email@hidden>
    • Re: figuring out which TableView I am?
      • From: Jim Correia <email@hidden>
References: 
 >figuring out which TableView I am? (From: David Scheidt <email@hidden>)
 >Re: figuring out which TableView I am? (From: WT <email@hidden>)
 >Re: figuring out which TableView I am? (From: David Scheidt <email@hidden>)
 >Re: figuring out which TableView I am? (From: WT <email@hidden>)
 >Re: figuring out which TableView I am? (From: David Scheidt <email@hidden>)
 >Re: figuring out which TableView I am? (From: Jonathan Hess <email@hidden>)
 >Re: figuring out which TableView I am? (From: WT <email@hidden>)
 >Re: figuring out which TableView I am? (From: Jim Correia <email@hidden>)

  • Prev by Date: Re: figuring out which TableView I am?
  • Next by Date: Re: figuring out which TableView I am?
  • Previous by thread: Re: figuring out which TableView I am?
  • Next by thread: Re: figuring out which TableView I am?
  • Index(es):
    • Date
    • Thread