0
我已经像这样限定,其保持Foo
对象的NSArray
:搜索结果总是0(NSArray的和NSPredicate)
@interface Foo : NSObject <NSCopying> {
NSString *name;
}
@property (nonatomic, retain) NSString *name;
@end
和查询:
NSPredicate *filterPredicate = [NSPredicate predicateWithFormat:@"name BEGINSWITH[cd] %@", filterString];
//NSPredicate *filterPredicate = [NSPredicate predicateWithFormat:@"name CONTAINS[cd] %@", filterString];
filteredArray = [[originalArray filteredArrayUsingPredicate:filterPredicate] mutableCopy];
,这是行不通的。我总是得到0结果。
所以,我的问题是:
应该我总是用NSPredicate
与特定键搜索只NSDictionary
对象或我可以使用它,只要有一个属性/方法与查询匹配搜索任何对象(在这种情况下:姓名)?
在此先感谢
.....或'nil'? – 2010-10-29 19:11:24
或'nil' .... :) – 2010-10-29 19:25:03
谢谢,事实上它似乎是正确的,我意识到我的错误是在别的地方。 ( – nacho4d 2010-10-30 06:00:33