• 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: Search Array for Variable in Object
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • Re: Search Array for Variable in Object
      • From: mmalcolm crawford <email@hidden>
  • Prev by Date: Re: resize image with cocoa
  • Next by Date: Re: NSToolbar missing notification?
  • Previous by thread: Re: Search Array for Variable in Object
  • Next by thread: Re: Search Array for Variable in Object
  • Index(es):
    • Date
    • Thread