Created
November 30, 2016 15:58
-
-
Save ManWithBear/452e2b2b846f42314652210754581e93 to your computer and use it in GitHub Desktop.
Find first tableView in hierarchy
This file contains hidden or 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