views:

30

answers:

2

This is going to be hard to demonstrate in code, but maybe you can picture it with me.

I have a view that contains two UITextFields, "title" and "descr". That same view contains two UIButtons that push another controller onto the navController to get more detail from the user about the object we're assembling and ultimately uploading to my server.

It appears that pushing another view on, doing something, and popping it back off results in the two UITextFields keeping their content VISUALLY, but the .text property of those fields becomes NULL. I've confirmed that if I do my two push-pop fields before filling in those UITextFields, I get my data when I upload, and if I do them in the opposite order, I don't. It LOOKS like there's data there, but I get nothing when I NSLog their .text properties.

Is this normal? Do I need to just design around this? Or is this as weird as it seems, and I should be looking deeper at causes of this?

+1  A: 

I bet that you loose the references to the text fields.

Try to check 2 things:

  • Check if you have anything except the text (e.g. color, font, text alignment) - maybe the text view are nil
  • Try to write something into the text fields after the push-pop and then see if you have the .text property
Michael Kessler
A: 

Took me a while to get back to that (my BIG stack of bugs is getting ever smaller as release date approaches!), but I figured it out. On viewWillAppear, I was doing a reloadData on the table that these fields were in, and that was resetting my form fields. I stashed my data before that reloadData call and re-populated them in the tableView:cellForRowAtIndexPath: method, and we're golden.

Dan Ray