Last active
October 13, 2015 19:07
-
-
Save samrayner/4241682 to your computer and use it in GitHub Desktop.
Select nearest parent UITableViewCell of a view
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
- (void)selectParentTableViewCell:(UIView *)view | |
{ | |
//maximum 5 attempts | |
for(int i = 0; i < 5; i++) { | |
view = view.superview; | |
if([view isKindOfClass:[UITableViewCell class]]) { | |
UITableViewCell *cell = (UITableViewCell *)view; | |
[self.tableView selectRowAtIndexPath:[self.tableView indexPathForCell:cell] animated:NO scrollPosition:UITableViewScrollPositionNone]; | |
break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment