[NSArrayController] finding object
[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