To avoid checking the iOS version, iteratively walk up the superviews from the cell's view until a UITableView is found:

id view = [tableViewCellInstance superview];

while (view && [view isKindOfClass:[UITableView class]] == NO) {
    view = [view superview]; 
}

UITableView *tableView = (UITableView *)view;