title: Add UITableViewCell with UITextField Dynamically
body: <p>I'm attempting to have a UITableView that I can dynamically add and remove rows from, and the rows have a UITextField in them. For adding the rows, I'm using the code:</p>
  
  <pre><code>- (void) addRow
      {
          [nameArray addObject:[NSString stringWithFormat:@"%i", x]];
          [self.tableView reloadData];
          x++;
      }
  </code></pre>
  
  <p>And I'm just doing a count of nameArray to get how many rows I have in my tableView. Then, inside of cellForRowAtIndexPath, I've got the following code </p>
  
  <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  {
      ...
      /*Default Apple-y stuff*/
      ...
      if ([indexPath row] == 0) {
          playerTextFieldZero = [[UITextField alloc] initWithFrame:CGRectMake(20, 10, 185, 30)];
          playerTextFieldZero.adjustsFontSizeToFitWidth = YES;
          playerTextFieldZero.placeholder = @"Name";
          playerTextFieldZero.textColor = [UIColor blackColor];
          playerTextFieldZero.returnKeyType = UIReturnKeyDone;
          playerTextFieldZero.backgroundColor = [UIColor whiteColor];
          playerTextFieldZero.autocorrectionType = UITextAutocorrectionTypeNo; // no auto correction support
          playerTextFieldZero.textAlignment = UITextAlignmentLeft;
          playerTextFieldZero.tag = 0;
          playerTextFieldZero.delegate = self;
          playerTextFieldZero.clearButtonMode = UITextFieldViewModeNever; // no clear 'x' button to the right
          [playerTextFieldZero setEnabled: YES];
          [cell addSubview:playerTextFieldZero];
          [playerTextFieldZero becomeFirstResponder];
          [playerTextFieldZero release];
      }
      ...
      /*More of those in here*/
      ...
  return cell;
  }
  </code></pre>
  
  <p>I've got multiple issues with this code. The first issue is I'm doing a preset number of UITextFields, so that I can call them all in textFieldShouldReturn. Is there a good way for me to generate UITextFields that will return when I press the done key?</p>
  
  <p>The second biggest issue with the way I'm doing this right now is my UITextFields get cleared every time I add a new one. Any idea why?</p>