转自:http://blog.sina.com.cn/s/blog_4cd8dd130101ntev.html
概览
简单的比较,比如 grade== "7" 或者 firstNamelike "Shaffiq"
不区分大小写和音调的查找,比如 namecontains[cd] "itroen"
逻辑运算,比如 (firstName like "Mark") OR (lastName like"Adderley")
In OS X v10.5 and later,you can create €œbetween€ predicates suchas datebetween {$YESTERDAY,$TOMORROW}.
group.name like "work*"
ALL children.age > 12
ANY children.age > 12
任务
[plain] view plaincopy
+ predicateWithFormat:
+ predicateWithFormat:argumentArray:
+ predicateWithFormat:arguments:
– predicateWithSubstitutio
nVariables:
+ predicateWithValue:
+ predicateWithBlock:
– evaluateWithObject:
– evaluateWithObject:substitutionVariables:
– predicateFormat
类方法
1.predicateWithBlock:
+ (NSPredicate *)predicateWithBlock:(BOOL (^)(id evaluatedObject,NSDictionary *bindings))block;
参数
block
返回值
特殊考虑
有效性
声明于
2.predicateWithFormat:
+ (NSPredicate *)predicateWithFormat:(NSString *)format,...
讨论
相关的代码例子
3.predicateWithFormat:argumentArray:
+ (NSPredicate *)predicateWithFormat:(NSString *)predicateFormatargumentArray:(NSArray*)arguments
4.predicateWithFormat:arguments:
5.predicateWithValue:
+ (NSPredicate *)predicateWithValue:(BOOL)value
实例方法
1.evaluateWithObject:
- (BOOL)evaluateWithObject:(id)object
2.evaluateWithObject:substitutionVariables:
- (BOOL)evaluateWithObject:(id)objectsubstitutionVariables:(NSDictionary *)variables
3.predicateFormat
- (NSString *)predicateFormat
4.predicateWithSubstitutio
nVariables:
- (NSPredicate *)predicateWithSubstitutio
nVariables:(NSDictionary*)variables