NSPredicate メモ

More than 3 years have passed since last update.

複数条件適用する記法の備忘録

NSMutableArray *predicateArray = [@[] mutableCopy];

[predicateArray addObject:[NSPredicate predicateWithFormat:@"id != %@", @"hoge"]];
[predicateArray addObject:[NSPredicate predicateWithFormat:@"id != %@", @"fuga"]];

NSPredicate* predicate = [NSCompoundPredicate andPredicateWithSubpredicates:predicateArray];

[target filteredArrayUsingPredicate:predicate];

orPredicateWithSubpredicates notPredicateWithSubpredicate もある。