开发者

Possible to limit results returned by NSArray filteredArrayUsingPredicate

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;
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜