• 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
How to iterate through IBObjects?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to iterate through IBObjects?


  • Subject: How to iterate through IBObjects?
  • From: email@hidden
  • Date: Sun, 19 Sep 2004 12:56:30 -0700

I thought sure that the subject line would turn up the golden answer -
using big words like "iterate" and all ;)

I am trying to builid a dictionary right before my save and am
erroring because some of the IBOutlets are nil (which they are allowed
to be).

I am trying:

NSArray * ray = [NSArray arrayWithObjects:[[card1 image] name], [[card2 image] name], [[card3 image] name], [[card4 image] name], [[card5 image] name], [[card6 image] name], [card7 image] name], [[card8 image] name], [[card9 image] name], [[card10 image] name], nil];


NSArray * keys = [NSArray arrayWithObjects: @"card1", @"card2", @"card3", @"card4", @"card5", @"card6",
@"card7", @"card8", @"card9", @"card10", nil];

From these two I am going to create an NSDictionary from

 [NSDictionary dictionaryWithObjects: ray forKeys:keys];

* BUT *

What if a user leaves  card2 blank (which they can) --> then the dictionary build fails :(

I was thinking :  "Perhaps I can iterate through the IBOutlets, check if they are null ..."

But then I have to build an NSArray - same problem I currently have...so that's a no..

I thought, OK, I can iterate through the 'keys' array but I realized
that I don't know how to translate an NSString in such a way that it
gets me the instance of the same name.  i.e. given @"card1" how can i
then use methods associated with the instance [card1] - is that possible?

So I guess I'm looking for someone to point me to a "standard" cocoa way of handling this.

Thanks,

Steven

--

Steven G. Harms

         ||                     ||          email@hidden
        :||:                   :||:
       ::||::                 ::||::
     .:::||:::.             .:::||:::.
...::::::||::::::. . . . ..:::::||::::::...
[[Cisco Systems:  Empowering the Internet Generation]]

Attachment: pgpvumRYLWKbi.pgp
Description: PGP signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: How to iterate through IBObjects?
      • From: Sherm Pendley <email@hidden>
  • Prev by Date: Re: Develop a plugin for Final Cut Pro
  • Next by Date: Re: modal window + sheet
  • Previous by thread: Announcement: Redland (RDF) Cocoa Bindings
  • Next by thread: Re: How to iterate through IBObjects?
  • Index(es):
    • Date
    • Thread