Skip navigation.
 
mlRe: Predicate expressions
FROM : Hamish Allan
DATE : Sun Jun 01 21:40:17 2008

On Sun, Jun 1, 2008 at 8:26 PM, Kyle Sluder
<kyle.sluder+<email_removed>> wrote:

> On Sat, May 31, 2008 at 4:57 PM, Fabian <<email_removed>> wrote:

>> NSArray *arrayB = [self getObjects] ;
>>
>> NSArray *titles = [arrayB arrayByApplyingSelector:@selector(title)];
>> NSArray *subtitles = [arrayB arrayByApplyingSelector:@selector(subtitle)];
>>
>> NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(title IN
>> %@) AND (subtitle IN %@)", titles, subtitles];
>> NSArray *result = [arrayA filteredArrayUsingPredicate:predicate];

>
> I am *really* confused as to what you're trying to do here.  You have
> asked the NSArray for all objects from array B whose title is in the
> collection of all titles of objects in array B and whose subtitle is
> in the collection of all subtitles of objects in array B.  Basically,
> you have said "give me all the objects."


He's asking for all objects of array *A* whose titles and subtitles
are in the collections from array B (see the target of
'filteredArrayUsingPredicate: above).

Hamish

Related mailsAuthorDate
mlPredicate expressions Fabian May 31, 22:57
mlRe: Predicate expressions Kyle Sluder Jun 1, 21:26
mlRe: Predicate expressions Hamish Allan Jun 1, 21:35
mlRe: Predicate expressions Hamish Allan Jun 1, 21:40