iphone - How to search an NSSet or NSArray for an object which has an specific value for an specific property? -
How does a NSSet or NSArray search for objects with a specific value for a particular property? Example: I have an NSSet with 20 items, and each object has a type property I want to get the first object, in which [theObject.type isEqualToString : @ "Standard"] .
I remember that it is possible to predict some kind of stuff like this, right?
NSPredicate * predicate = [NSPredicate predicateWithFormat: @ "type ==% @", @ " standard "]; NSArray * Filtered array = [myArray filtered arraying press: bidet]; Id firstFoundObject = zero; FirstFoundObject = Filtered Horizontal & gt; 0? Filtered array First object: zero; NB: There is no point in identifying the first object in an NSE, because the order of objects in the set is undefined.
Comments
Post a Comment