UITableview - Setting a property for cell is messed up with reused cells
<p>I have a UITableView which act as a form.
It has about 20 cells (with static content but dynamic cells).
So I had an array with the fields and loading it in the table view.
At some time the user will press the <strong>"Submit"</strong> button and I need all the textfields values that entered in the tableview's cells.
So I created a <code>@property</code> for each textfield in each cell and I am assigning it in the <code>cellForRowAtIndexPath:</code>.</p>

<pre><code> if (indexPath.row==RPCVehicleType || indexPath.row==RPCExcess || indexPath.row==RPCDrivers){

    static NSString *tableIdentifier = @"TextFieldArrowCell";

    TextFieldArrowCell *cell = (TextFieldArrowCell*)[tableView dequeueReusableCellWithIdentifier:tableIdentifier];

    if (cell == nil) {
        cell = [[TextFieldArrowCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:tableIdentifier];
    }

    switch (indexPath.row) {
        case RPCVehicleType:
            self.typeOfVehicleTextfield = cell.valueField;
            break;
        case RPCExcess:
            self.excessTextfield = cell.valueField;
            break;
        case RPCDrivers:
            self.driversTextfield = cell.valueField;
            break;
        default:
            break;
    }

    return cell;
</code></pre>

<p>The problem with this code is that when I scroll to the bottom the cells are being reused and the properties are messed. So when I do <code>[self.excessTextField setText:@"123"]</code> the first time it's ok but after scrolling and execute again I can see other textfields of the same type of cell to change to that value.
Any workaround to solve this issue?</p>

<p><strong>Update:</strong>
Tried this approach with the same result:</p>

<pre><code>-(UITextField*)getTextFieldForRow:(NSInteger)row{

NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row inSection:0];
TextFieldArrowCell *cell = [self.tableV cellForRowAtIndexPath:indexPath];

return cell.valueField;
</code></pre>

<p>}</p>