大佬教程收集整理的这篇文章主要介绍了AND和OR结合NSPredicate. IOS斯威夫特,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
var preDicate = [NSPreDicate]() //this three is or preDicate.append(NSPreDicate(format: "item_parent_id = %i",1)) preDicate.append(NSPreDicate(format: "item_parent_id = %i",3)) preDicate.append(NSPreDicate(format: "item_parent_id = %i",5)) // but this one is and preDicate.append(NSPreDicate(format: "price_date CONTAINS[cd] %@",'timestamp')) var compound = NSCompoundPreDicate.orPreDicateWithSubpreDicates(preDicatE)@H_616_5@OR运算符的前三个约束,日期的最后一个约束是AND @H_616_5@我花了很多时间来做这件事,我是快速发展的新手,我不习惯于目标C,这就是为什么我很难转换为我在客观c中写的快速翻译. @H_616_5@如果可能的话,快速写下答案,任何评论和建议都将是一个很大的帮助.提前致谢 @H_616_5@obj c – source #1
var orList = [NSPreDicate]() //this three is or orList.append(NSPreDicate(format: "item_parent_id = %i",1)) orList.append(NSPreDicate(format: "item_parent_id = %i",3)) orList.append(NSPreDicate(format: "item_parent_id = %i",5)) let orPreDicate = NSCompoundPreDicate.orPreDicateWithSubpreDicates(orList) // but this one is and let other = NSPreDicate(format: "price_date CONTAINS[cd] %@",'timestamp') let compound = NSCompoundPreDicate.andPreDicateWithSubpreDicates([orPreDicate,other])
以上是大佬教程为你收集整理的AND和OR结合NSPredicate. IOS斯威夫特全部内容,希望文章能够帮你解决AND和OR结合NSPredicate. IOS斯威夫特所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。