0

My problem: I use IOS 5 and prototype cells. In 'cellForRowAtIndexPath' function I set up my cell like that:

        cell = [aTableView dequeueReusableCellWithIdentifier:@"datiInvioCell"];   
        UITextField *testo = (UITextField*)[cell viewWithTag:1];    
        testo.placeholder = iv.descrizione;
        testo.text = iv.valore;

Now, I must store the result of the cell editing into an array. I used to do it like that:

      -(void) textFieldDidEndEditing:(UITextField *)textField {
              InputInvio *iv = [self.cellDettagli objectAtIndex:textField.tag]; 
              iv.valore = textField.text;
        }

but I can't use textField.tag anymore! Any idea? Thanks.

PoorMe
  • 1
  • "but I can't use textField.tag anymore" <- what does this mean? Your boss comes at you and yells "You can't use textField.tag from now on!"? –  May 16 '12 at 15:01
  • I'm with H2CO3, why can't you use `.tag` anymore? – Justin Paulson May 16 '12 at 15:07
  • I use tag to get the textField in the prototype cell ( (UITextField*)[cell viewWithTag:1]; ) if I change tag I can't use viewWithTag anymore – PoorMe May 16 '12 at 15:52
  • Found! [link]http://stackoverflow.com/questions/9274494/how-to-know-the-uitableview-row-number/9274863#9274863[/link] – PoorMe May 25 '12 at 18:33

1 Answers1

0

here you use static tag for your every textField so its get only one value which last..... so here when you use bellow line just replace may be after that its work..

UITextField *testo = (UITextField*)[cell viewWithTag:indexPath.row];

here every textfield has its own tag... hope , this help you.. :)

Paras Joshi
  • 20,427
  • 11
  • 57
  • 70