-
-
Save azu/2948459 to your computer and use it in GitHub Desktop.
NSArrayからNSIndexSetに該当するAtIndexのものだけを取り出したNSArrayを取得
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]]; | |
}]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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