Created
July 23, 2014 19:34
-
-
Save calebhicks/15e5f75c41e819772825 to your computer and use it in GitHub Desktop.
Parent Table View of Custom TableViewCell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(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