Iphone 如何使用“创建同时包含两个”的复合谓词;或;及;及;
我获取了以下3个类别,但希望添加一个“AND”谓词以缩小结果范围,其中“mark”处于启用状态Iphone 如何使用“创建同时包含两个”的复合谓词;或;及;及;,iphone,ios,Iphone,Ios,我获取了以下3个类别,但希望添加一个“AND”谓词以缩小结果范围,其中“mark”处于启用状态 //我想这样做: NSPredicate *finalPredicate = [compoundPredicate && markPredicate]; [fetchRequest setPredicate:finalPredicate]; 这就是你要找的吗 NSPredicate *finalPredicate = [NSCompoundPredicate andPredica
//我想这样做:
NSPredicate *finalPredicate = [compoundPredicate && markPredicate];
[fetchRequest setPredicate:finalPredicate];
这就是你要找的吗
NSPredicate *finalPredicate = [NSCompoundPredicate andPredicateWithSubpredicates:
[NSArray arrayWithObjects:compoundPredicate, markPredicate, nil]];
或者,对容器文本使用“modern Objective-C”语法:
NSPredicate *finalPredicate = [NSCompoundPredicate andPredicateWithSubpredicates:
@[compoundPredicate, markPredicate]];
NSPredicate *finalPredicate = [NSCompoundPredicate andPredicateWithSubpredicates:
[NSArray arrayWithObjects:compoundPredicate, markPredicate, nil]];
NSPredicate *finalPredicate = [NSCompoundPredicate andPredicateWithSubpredicates:
@[compoundPredicate, markPredicate]];