Created
September 26, 2011 00:10
-
-
Save CocoaPriest/1241350 to your computer and use it in GitHub Desktop.
фильтрация
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ------------- с предикатом | |
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"groupID >= %d", 1]; | |
NSArray *filteredArray = [myArray filteredArrayUsingPredicate:predicate]; | |
// ------------- с блоками | |
NSIndexSet *filteredIndexes = [myArray indexesOfObjectsPassingTest:^BOOL(id obj, NSUInteger idx, BOOL *stop) { | |
if(obj.groupID >= 1) | |
return YES; | |
return NO; | |
}]; | |
NSArray *filteredArray = [myArray objectsAtIndexes:filteredIndexes]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment