Skip to content

Instantly share code, notes, and snippets.

@basuke
Created July 7, 2010 04:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save basuke/466296 to your computer and use it in GitHub Desktop.
Save basuke/466296 to your computer and use it in GitHub Desktop.
/* 配列の配列からオブジェクトを検索しindexPathを返す */
- (NSIndexPath *)indexPathOfItem:(id)item {
__block NSIndexPath *indexPath = nil;
[groups_ enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
NSInteger row = [(NSArray *)obj indexOfObject:item];
if (row != NSNotFound) {
indexPath = [NSIndexPath indexPathForRow:row inSection:idx];
*stop = YES;
}
}];
return indexPath;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment