Skip to content

Instantly share code, notes, and snippets.

@ecerney
Created May 22, 2014 23:28
Show Gist options
  • Save ecerney/5fe0f36188958caec4fd to your computer and use it in GitHub Desktop.
Save ecerney/5fe0f36188958caec4fd to your computer and use it in GitHub Desktop.
int desiredRow = whatever;
int currentRow = 0;
for (int section = 0; section < [self.collectionView numberOfSections]; section++) {
for (int row = 0; row < [self.collectionView numberOfItemsInSection:section]; row++) {
if (currentRow == desiredRow) {
indexPath = [NSIndexPath indexPathForRow:row inSection:section];
}
currentRow++;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment