Re: Search Array for Variable in Object
Re: Search Array for Variable in Object
- Subject: Re: Search Array for Variable in Object
- From: Steve Gran <email@hidden>
- Date: Mon, 5 Dec 2005 13:19:25 -0800
As I read this and the other detailed information about NSPredicate,
it looks like the predicate only searches for the Object. But maybe
I'm incorrect.
Again, I'm really hoping there is a way to be able to search instance
variables of an object and then return the value of the particular
instance variable I'm searching for.
So if myArray holds a bunch of objects (myObject1, myObject2, etc.)
and each object has a few instance variables, my goal is to have a
way to search the array for, say when varTwo ==
@"WhatIWant" (obviously varTwo is a NSString) and then return that
string.
Unfortunately it looks as if the predicate needs to search for the
object only, let's say in this case it's "myObject3" or some portion
of the name of myObject (again in this case myObject3), and will then
return a new Array that contains myObject3. But it doesn't appear to
have the ability to look inside the object and search instance
variables of an object. Which of course is really want I want to be
able to do.
><
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/
>ObjC_classic/Classes/NSArray.html#//apple_ref/occ/instm/NSArray/
>filteredArrayUsingPredicate:>
>mmalc
>> How would I search myArray to find an object whose varTwo (an
>> NSString)= "The Key String"
_______________________________________________
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