How to get indexes from NSIndexset into an NSArray in cocoa?

后端 未结 5 1644
Happy的楠姐
Happy的楠姐 2020-12-11 01:20

I\'m getting the select items from a table view with:

NSIndexSet *selectedItems = [aTableView selectedRowIndexes];

what\'s the best way to

5条回答
  •  醉话见心
    2020-12-11 01:50

    Here is the sample code:

    NSIndexSet *filteredObjects = [items indexesOfObjectsPassingTest:^BOOL(id obj, NSUInteger idx, BOOL *stop) {do testing here}];
    
    NSArray *theObjects = [theItems objectsAtIndexes:filteredObjects]
    

    Availability Available in iOS 2.0 and later.

提交回复
热议问题