title: Editing TextLabel in a UITableViewCell
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2803626/how-to-do-edit-in-place-in-a-uitableview">How to do edit-in-place in a UITableView?</a>  </p>
  </blockquote>
  
  
  
  <p>I am new to this iphone developing.
  I just want to know how to edit/update UITextLabel in a tableView.</p>
  
  <p>I am already using edit/done animation and able to delete rows but i am not able to get how to  edit the text in those rows.</p>
  
  <p>I want the user to edit the textlabel of the cell.when edit button is tapped.</p>
  
  <p>i already searched the site but couldnt get the exact answer.</p>
  
  <pre><code>-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  {
  UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CellIdentifier"];
  if(!cell)
  {
      cell = [[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"CellIdentifier"]autorelease];
      cell.editingAccessoryType=YES;
  }
  
  
  myTextField = [[UITextField alloc] initWithFrame:CGRectMake(15, 6, 241, 31)];
  myTextField.backgroundColor = [UIColor clearColor];
  myTextField.textAlignment = UITextAlignmentLeft;
  myTextField.returnKeyType = UIReturnKeyDone;
  myTextField.delegate = self;
  cell.accessoryView = myTextField;
  myTextField.text = [self.arrayOfItems objectAtIndex:indexPath.row];
  myTextField.enabled = NO;
  return cell;
  }
  
  -(IBAction)Edit:(id)sender
  {
  if(self.editing)
  {
              [myTextField.Enabled = YES];
      [super setEditing:NO animated:NO];
      [self.tab setEditing:NO animated:NO];
      [self.tab reloadData];
      [self.navigationItem.rightBarButtonItem setTitle:@"Done"];
      [self.navigationItem.rightBarButtonItem setStyle:UIBarButtonItemStylePlain];
  }
  else 
  {
      myTextField.enabled= YES;
  
      [super setEditing:YES animated:YES];
      [self.tab setEditing:YES animated:YES];
      [self.tab reloadData];
      [self.navigationItem.rightBarButtonItem setTitle:@"Edit"];
      [self.navigationItem.rightBarButtonItem setStyle:UIBarButtonItemStyleDone];
   }
   }
  
  - (UITableViewCellEditingStyle)tableView:(UITableView *)aTableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath 
  {
  if (self.editing == NO || !indexPath) 
  return UITableViewCellEditingStyleNone;
  if (self.editing &amp;&amp; indexPath.row == ([self.arrayOfItems count])) 
  {
      return UITableViewCellEditingStyleInsert;
  } 
  else 
  {
      return UITableViewCellEditingStyleDelete;
  }
  return UITableViewCellEditingStyleNone;
  }
  </code></pre>
  
  <p>This is not working for me.textfield is disappearing if i hit edit button</p>