Created
March 25, 2016 19:00
-
-
Save mike3k/d1dfe1b83dc3b416347d to your computer and use it in GitHub Desktop.
A way to find the table view from a table view cell
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
@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