NSArray有一些有用的方法可以根据指定的索引查找对象。
// To find objects by indexes
- (id)objectAtIndex:(NSUInteger)index
- (NSArray *)objectsAtIndexes:(NSIndexSet *)indexes
// To find index by object
- (NSUInteger)indexOfObject:(id)anObject
然而,我想要获取给定对象的
NSIndexSet
(多个索引)。类似于以下内容:- (NSIndexSet *)indexesOfObjects:(NSArray *)objects
对于NSArray
,不存在这种方法。我是否漏掉了什么?有人知道其他标准方法吗?否则我就要将其写成类别方法。