• 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: What is the best way to store some kind of identifying string in an interface builder object?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What is the best way to store some kind of identifying string in an interface builder object?


  • Subject: Re: What is the best way to store some kind of identifying string in an interface builder object?
  • From: Erik Buck <email@hidden>
  • Date: Thu, 18 Jun 2009 10:59:13 -0700 (PDT)

See the - (void)setRepresentedObject:(id)anObject method of NSCell.  You can set a string or dictionary and the represented object and retrieve it via -representedObject.
 
You can also instantiate an array and add objects to the array within IB.  Then you only need an outlet instance variable to reference the array and not separate instance variables for all of the user interface objects.  See "Foundation Collections Palette"  You can populate the array  entirely within IB. Make any target/action connections in IB.
http://www.geocities.com/kritter_cocoadev/

 
For some final advice: Don't do what you are contemplating.  Users hate interfaces that change outside the user's control.  If a group of objects are going to appear or disappear, consider whether they should become enabled or disabled instead.  If objects are logically associated, group the objects together visibly in boxes or matrix or tabs or through other means.  Then you can enable or disable all elements of the box in code without needing to have outlets for every element.  You can even hide or unhidden the whole box.
 
use
[[myBox subviews] makeObjectPerformSelector:@selector(setEnabled:) withObject:NO];
 
or similar.
 
 
_______________________________________________

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: What is the best way to store some kind of identifying string in an interface builder object?
      • From: Graham Cox <email@hidden>
    • Re: What is the best way to store some kind of identifying string in an interface builder object?
      • From: Michael Ash <email@hidden>
  • Prev by Date: Re: MDSchemaCopyAllAttributes() returning nil
  • Next by Date: Re: Group CGAffineTransform Animations?
  • Previous by thread: Re: NSInterger Infinity?
  • Next by thread: Re: What is the best way to store some kind of identifying string in an interface builder object?
  • Index(es):
    • Date
    • Thread