Skip to content

Instantly share code, notes, and snippets.

@mike3k
Created March 25, 2016 19:00
Show Gist options
  • Save mike3k/d1dfe1b83dc3b416347d to your computer and use it in GitHub Desktop.
Save mike3k/d1dfe1b83dc3b416347d to your computer and use it in GitHub Desktop.
A way to find the table view from a table view cell
@implementation UITableViewCell (MyAdditions)
- (UITableView *)parentTableView {
UITableView *tableView = nil;
UIView *view = self;
while(view != nil) {
if([view isKindOfClass:[UITableView class]]) {
tableView = (UITableView *)view;
break;
}
view = [view superview];
}
return tableView;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment