我有一个标签列表,如第1项,第2项,我希望使用NSPredicate过滤数组,如果字段匹配这些项目中的任何内容.这没有完成它:
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"ANY tags CONTAINS[c] %@", tag];
results = [results filteredArrayUsingPredicate:predicate];
Run Code Online (Sandbox Code Playgroud)
使用IN运算符,后跟标记数组.
predicate = [NSPredicate predicateWithFormat:@"ANY tags IN %@", theTags];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
672 次 |
| 最近记录: |