有一个NSArray,我想用predicate过滤一下。
NSLog(@"text is %@",txtSearch.text);
NSPredicate *bPredicate =
[NSPredicate predicateWithFormat:@"SELF beginswith[c] '%@'",txtSearch.text];
arrSearchedPlayers =
[arrPlayers filteredArrayUsingPredicate:bPredicate];
NSLog(@"array after searched is %@",arrSearchedPlayers);
但是再输入文本时数组还是空的,使用下面的predicate的话就结果正常:
NSPredicate *bPredicate =
[NSPredicate predicateWithFormat:@"SELF beginswith[c] 's'"];
这是为什么呢?