0

I'm doing something silly here but for the life of me i cannot see it.

Push from ViewControllerA to ViewController B: No transfer of data.

Segue back from ViewControllerB to ViewController A: Data transfers.

Push from ViewControllerA to ViewController B: Previous labels and datepicker values are reset and do not stay as previously selected.

How do i get ViewControllerB labels to stay as they previously were?

I know it is something obvious, i would appreciate your extra sets of eyes!

Let me know if you need more information or anything.

jkd359
  • 151
  • 4
  • 16
  • Thanks peoples! All answers were helpful but best way to do it seems to be through state control. – jkd359 Feb 21 '14 at 00:00

3 Answers3

0

You'll have to remember the state and transfer the data from A to B, and have the labels and values set in B's viewDidLoad: or somewhere else convenient.

When ViewControllerB is popped off the navigation stack, the entire object is deallocated. As you're noticing, a fresh ViewControllerB is initialized each time.

gregheo
  • 4,182
  • 2
  • 23
  • 22
0

When ViewControllerB call back ViewControllerA, ViewControllerA was deallocated before, so that you can not push back data from viewcotrollerB to view controllerA. I think in this case, you can using delegate patter. Please show this question to see more detail Passing Data between View Controllers

Community
  • 1
  • 1
Tan Vu
  • 728
  • 8
  • 15
0

I think "Unwind Segues" will be the best solution for you. Take a look on the link below:

http://pragmaticstudio.com/blog/2013/2/5/unwind-segues

carantes
  • 197
  • 1
  • 9