Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First of all, please rewrite your getTextFieldValue method like this:</p> <pre><code>- (void)getTextFieldValue:(UITextField *)textField { NSLog(@"%d---&gt;%@", textField.tag, textField.text); } </code></pre> <p>You keep adding UITextFields to the cell, even when it's reused. Try putting that code inside the if statement.</p> <p>You should set the text of the text field to nil every time though. Else it will still be there on dequeued cells (when scrolling).</p> <p>Something like this:</p> <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ static NSString *CellIdentifier = @"myCell"; cell = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if(cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; cell.selectionStyle = UITableViewCellSelectionStyleNone; UILabel *nameLabel = [[UILabel alloc] initWithFrame:CGRectMake( 7.0, 10.0, 160.0, 44.0 )]; //TODO: Set up nameLabel here [cell.contentView addSubview: nameLabel]; [nameLabel release]; UITextField *tv = [[UITextField alloc] init]; tv.font = [UIFont boldSystemFontOfSize:12]; [tv setDelegate:self]; [tv addTarget:self action:@selector(getTextFieldValue:) forControlEvents:UIControlEventEditingDidEnd]; [cell.contentView addSubview:tv]; [tv release]; } UILabel *nameLabel = (UILabel *)[cell viewWithTag:1]; nameLabel.text = [labels objectAtIndex:indexPath.row]; [nameLabel sizeToFit]; return cell; } </code></pre>
    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.
    1. VO
      singulars
      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