Skip to content

Instantly share code, notes, and snippets.

@brennanMKE
Last active August 29, 2015 13:57
Show Gist options
  • Save brennanMKE/9730988 to your computer and use it in GitHub Desktop.
Save brennanMKE/9730988 to your computer and use it in GitHub Desktop.
indexPathForView:inTableView:
- (NSIndexPath *)indexPathForView:(UIView *)view inTableView:(UITableView *)tableView {
UIView *superview = view;
while (superview && ![superview isKindOfClass:[UITableViewCell class]]) {
superview = superview.superview;
}
if ([superview isKindOfClass:[UITableViewCell class]]) {
NSIndexPath *indexPath = [tableView indexPathForCell:(UITableViewCell *)superview];
return indexPath;
}
return nil;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment