配列に NSPredicate を使用するのは、filteredArrayUsingPredicate: を使用するとかなり簡単です。
これはキーパス値に対してどのように行われますか? つまり、オブジェクトの配列があります (この場合、オブジェクトは同じ型です)。各オブジェクトには、name という名前のインスタンス変数があります。ドキュメントによると、次のことを行うように指示されています。
NSPredicate *predicate = [NSPredicate predicateWithFormat:
@"ANY employees.firstName like 'Matthew'"];
それはfilteredArrayUsingPredicateでも使用されていますか? People オブジェクトの配列がある場合はどうなりますか? それは私が使用することを意味します:
NSArray *allPeopleObjects; // pre-populated
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"ANY people.name like 'Foo'"];
NSArray *matching = [allPeopleObjects filteredArrayUsingPredicate:predicate];
その部門ではドキュメンテーションが少し不足しています。
単一の Person オブジェクトに対して Predicate を使用することもできますか? Person.name のようなものに [cd] 'Foo' が含まれていますか? それはどのように行われますか?