开发者

I am having problems with my NSPredicate

I'm trying the following comparison but it does not work.

What is the appropriate syntax to use both the or/and operator within the same context?

N开发者_开发百科SPredicate* predicate = [NSPredicate predicateWithFormat:@"((day || day2 ==%@) && CourseTitle==%@)",day,courseSelected];
rows = [[courseArray filteredArrayUsingPredicate:predicate]retain];


Try:

NSPredicate* predicate = [NSPredicate predicateWithFormat:@"(((day == %@) OR (day2 == %@)) && CourseTitle==%@)",day, day, courseSelected];
rows = [[courseArray filteredArrayUsingPredicate:predicate]retain];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜