Powered By Blogger
Showing posts with label filteredArrayUsingPredicate. Show all posts
Showing posts with label filteredArrayUsingPredicate. Show all posts

Monday, January 7, 2013

NSPredicate to filter data in iPhone

Hi,
Please check the below lines for filtering a content of an array using "NSPredicate".

Example:

//For Boolean value checking in Array containing dictionaries.
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(isCheck == %@)",@"true"];
NSArray *filterArr = [tmpArray filteredArrayUsingPredicate:predicate];

NSPredicate *filter = [NSPredicate predicateWithFormat:[NSString stringWithFormat:@"ServiceLevel = '0'"]];        
NSArray *filteredArray = [[tmpArray filteredArrayUsingPredicate:filter]copy];











Thanks