Skip to content

Instantly share code, notes, and snippets.

@azu
Created June 18, 2012 13:49
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save azu/2948459 to your computer and use it in GitHub Desktop.
Save azu/2948459 to your computer and use it in GitHub Desktop.
NSArrayからNSIndexSetに該当するAtIndexのものだけを取り出したNSArrayを取得
NSMutableArray *dataSource;
NSMutableIndexSet *selectedIndexSet;
/*
dataSource,selectedIndexSetに突っ込む処理
*/
// dataSourceからselectedIndexSetにマッチするものだけを取り出す。
NSMutableArray *resultArray = [NSMutableArray array];
[self.selectedIndexSet enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL *stop) {
[resultArray addObject:[self.dataSource objectAtIndex:idx]];
}];
NSMutableArray *dataSource;
NSMutableIndexSet *selectedIndexSet;
/*
dataSource,selectedIndexSetに突っ込む処理
*/
// dataSourceからselectedIndexSetにマッチするものだけを取り出す。
NSArray *resultArray = [self.dataSource objectsAtIndexes:self.selectedIndexSet];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment