Note that there are some explanatory texts on larger screens.

plurals
  1. POAdding a UITextField to a UITableViewCell only shows a textField in the LAST cell
    primarykey
    data
    text
    <p>I have a table view that has many cells. Each cell has its own UITextField. I added the text fields programmatically. I want each and every textField to appear when the edit button is hit. (now table is in edit mode) and when pressed again, i want all of the textFields to vanish(leaving the edit mode). I know that i can accomplish this using the <code>hidden</code> property, but i tried doing this in this method:</p> <pre><code> - (IBAction)editButton:(id)sender { if (self.editing) { [self setEditing:NO animated:YES]; [self.myTableView setEditing:NO animated:YES]; EditButton.title = @"Edit"; cellText.hidden = YES; //&lt;-- THIS IS THE CODE } else { [self setEditing:YES animated:YES]; [self.myTableView setEditing:YES animated:YES]; EditButton.title = @"Done"; cellText.hidden = NO; //&lt;-- THIS IS THE CODE } } </code></pre> <p>but it only shows and hides the VERY LAST cell's textField. How can i get it to where it shows and then doesnt show EVERY cell's textFIeld? Many thanks in advance!!!</p> <p><strong>CELL FOR ROW</strong></p> <pre><code> - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; cellText = [[UITextField alloc]init]; [cellText setFrame:CGRectMake(190, 15, 55, 30)]; cellText.text = @"1"; cellText.borderStyle = UITextBorderStyleRoundedRect; cellText.hidden = YES; cellText.userInteractionEnabled = NO; [cell addSubview:cellText]; } return cell; } </code></pre> <p>Thanks in advance!! :D</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload