I\'ve a UITableViewCell in a UITableViewController.
In my cell there is a button that when you click takes you to another view with a
I had similar problem where I had to find the textFileds value from TableView
if ([Util isiOSVerGreaterThen7]) { // iOS 7
UIView *contentView = (UIView *)[textField superview];
UITableViewCell *cell = (UITableViewCell *)[contentView superview];
UITableView *tableView = (UITableView *)cell.superview.superview;
NSIndexPath *indexPath = [tableView indexPathForCell:cell];
NSInteger sectionOfTheCell = [indexPath section];
NSInteger rowOfTheCell = [indexPath row];
}
else { // iOS 6
UITableViewCell *cell = (UITableViewCell *)[textField superview];
UITableView *table = (UITableView *)[cell superview];
NSIndexPath *pathOfTheCell = [table indexPathForCell:cell];
NSInteger sectionOfTheCell = [pathOfTheCell section];
NSInteger rowOfTheCell = [pathOfTheCell row];
}
And Util is
+ (BOOL)isiOSVerGreaterThen7 {
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {
return NO;
} else {
return YES;
}
}