title: Navigating through UITextFields in different UITableViewCells when hitting next/done
body: <p>I've tried a few of the solutions in <a href="https://stackoverflow.com/questions/1347779/how-to-navigate-through-textfields-next-done-buttons">this thread</a>, but I'm having trouble. My table is loaded dynamically with data from plists, so I cannot create connections from one cell to another in storyboard. I implemented a custom UITableViewCell class called DSCell which has two DSTextField objects in it on the right side of the cell. When hitting enter on the leftmost DSTextField, it successfully shifts focus to the next field. But, when hitting enter on the right text field, it should move focus to the text field in the next cell (one row down). But it doesn't.</p>
  
  <p>The text fields in the cells have the tags 2 and 3.</p>
  
  <p>Here is my cellForRowAtIndex method:</p>
  
  <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  {
  
  static NSString *CellIdentifier = @"PaperCell";
  UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
  
  // Configure the cell...
  NSString *text = [_paper objectAtIndex:indexPath.row];
  UILabel *label = (UILabel *)[cell viewWithTag:1];
  label.text = text;
  
  
  // Set the "nextField" property of the second DSTextfield in the previous cell to the first DSTextField
  // in the current cell
  if(indexPath.row &gt; 0)
  {
      DSCell *lastcell = (DSCell *)[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:indexPath.row-1 inSection:indexPath.section]];
      DSTextField *lastField = (DSTextField *)[lastcell viewWithTag:3];
      DSTextField *currentField = (DSTextField *)[cell viewWithTag:2];
      lastField.nextField = currentField;
  }
  
  return cell;
  
  }
  </code></pre>
  
  <p>Here's the textFieldShouldReturn method:</p>
  
  <pre><code>- (BOOL) textFieldShouldReturn:(UITextField *) textField {
  
  DSTextField *field = (DSTextField *)textField;
  
  UIResponder *responder = field;
  [responder resignFirstResponder];
  
  responder = field.nextField;
  [responder becomeFirstResponder];
  
  return YES;
  
  }
  </code></pre>
  
  <p>Currently I'm attempting to set the nextField property of the second DSTextField to the current cell when cellForRowAtIndexPath is called, but it does not seem to work. I start at row 1 and attempt to retrieve the cell in the previous row, then assign the rightmost text field's nextField property to the leftmost text field in the current cell. </p>
  
  <p>Is there a better way to do this? I don't want to have different tags for every single text field and do it that way, that could get messy.</p>