• 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
[NSArrayController] finding object
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[NSArrayController] finding object


  • Subject: [NSArrayController] finding object
  • From: Administrateur internet lutin Ludique <email@hidden>
  • Date: Fri, 11 Nov 2005 11:19:56 +0100

Hi,

here is the problem.

I've got a arrayController which manage a collection of objects in its NSArray content parameter.

All objects are instances from the same class. This class has several parameters. One of these is "id_number" which stores the unique id number of the object in the database.

I'd like to get a handle on the object with a specific id_numer in the collection.
How can I do that ?


For the time being, th only method i foud is to implement a "response" method in my object class.
- (void) doIHaveThisID: (NSString*) anIdNumber sender: (id) aSender ;
{ if ( [self valueForKey: @"id_number"] == anIdNumber)
[sender iAmTheOne: self] ; }


And in the controller:
  - (void) iAmTheOne: (id) anObject
      { do whatever I whish with anObject now that I found it}

Then by calling
[ [arrayController content] makeObjectsPerformSelector: (sel) "doIHaveThisID"
withObject: self] ;


But I think this technic is quite heavy. There must be something more elegant.

Thanks.

_______________________________________________
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: [NSArrayController] finding object
      • From: Miguel Sanchez <email@hidden>
  • Prev by Date: Re: Progress bar
  • Next by Date: [Binding] NSObjectController content
  • Previous by thread: Re: How to see the arguments of methods from the stack trace during debugging
  • Next by thread: Re: [NSArrayController] finding object
  • Index(es):
    • Date
    • Thread