我可以将NSPredicate应用于与日期相对应的字典数据的过滤器数组吗?
NSPredicate *betweenPredicate =[NSPredicate predicateWithFormat: @"attributeName BETWEEN %@", @[@1, @10]];
NSDictionary *dictionary = @{ @"attributeName" : @5 };
BOOL between = [betweenPredicate evaluateWithObject:dictionary];
if (between)
{
NSLog(@"between");
}
我得到的解决方案是按日期为过滤器myArray设置以下谓词格式。
当数组中有大量数据时,它的速度确实非常快。
NSArray *filteredarray = [myArray filteredArrayUsingPredicate:[NSPredicate
predicateWithFormat:@"(EventStartDateForMonthview <= %@) AND
(EventEndDateForMonthview >= %@)", strOndate,strOndate]];
谢谢
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句