Skip to content

Instantly share code, notes, and snippets.

@calebhicks
Created July 23, 2014 19:34
Show Gist options
  • Save calebhicks/15e5f75c41e819772825 to your computer and use it in GitHub Desktop.
Save calebhicks/15e5f75c41e819772825 to your computer and use it in GitHub Desktop.
Parent Table View of Custom TableViewCell
-(UITableView *) parentTableView {
// iterate up the view hierarchy to find the table containing this cell/view
UIView *aView = self.superview;
while(aView != nil) {
if([aView isKindOfClass:[UITableView class]]) {
return (UITableView *)aView;
}
aView = aView.superview;
}
return nil; // this view is not within a tableView
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment