• 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: David Scheidt <email@hidden>
  • Date: Sat, 25 Apr 2009 13:26:08 -0400


On Apr 25, 2009, at 1:13 PM, WT wrote:

NSTableView inherits from NSControl, which has methods -tag and - setTag. I would suggest assigning a different tag value to each instance of your NSTableView subclass (you'd do that in your subclass' initializer or -awakeFromNib method) and use the -tag method to identify the instance when you need to do so.

That's perfect. Thanks!
It's also possible to set the tag in IB (it's on the Attributes Inspector palette, in the "control" tab). Since I'm not creating any dynamically, I can do that.





On Apr 25, 2009, at 6:47 PM, David Scheidt wrote:

I've got a sub-class of NSTableView. I have windows that have more than one instance of this TableView in them, which need to behave slightly differently, based on which one they are. (There are three different classes of data that they'll display, and the designer wants the background alternating color to be different based on what they're displaying.) Everything is instantiated from IB. Is there some way to figure out from the class itself which of the table views in the NIB it is? Two approaches occured to me; I'm not keen on either. First is to make N subclasses, each of the particular type. That would work, but seems ugly and a pain to maintain. Second is to check the delegate of the tableview, and based on what class it is, do the right thing. That seems slightly weird and wrong. Is there another way? Alternatively, am I going about this the wrong way from the start?


_______________________________________________

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: WT <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>)

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