I'm using [NSArray filteredArrayUsingPredicate] to get an array of objects that match certain conditions within an original array of 20,000 objects. Is it possible to limit th开发者_JS百科e number of results that this method returns in order to speed it up?
This would be similar to the LIMIT clause in SQL. Thanks.
No, with predicates not. But you could make an extension to NSArray which filters and limits the result for you.
- (NSArray*)filteredArrayUsingPredicate:(NSPredicate*)predicate
resultLimit:(NSUInteger)limit;
精彩评论