I have a tableView with custom cells. One of the objects in the cell is a textField.
The tableViewController is the textFieldDelegate.
The datasource for the table is an array of objects.
When the user tap on the textField, the tableViewController implements textField delegates methods controlling this way the data entry.
To use the data entered by user, the tableViewController implements the following:
- (BOOL)textFieldShouldEndEditing:(UITextField *)textField
{
CGPoint point = [textField center];
point = [self.tableView convertPoint:point fromView:textField];
NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:point];
...
...
return YES
}
I spent two hours trying to figure out why indexPath.row was always wrong, it was always row+1 of what it suppose to be. Solution: In the storyboard I move the textField to the upper portion of the cell. Has anyone see something like this before? Thanks.