0

I have seen the similar question in the StackOverflow, but my question is totally different one. I am working on a project where user has to go through several views 'stacked' up as series in UINavigationController.

As the user moves through navigation controllers, (s)he has to fill in the data in the form and continue. User is also allowed to come back and change information. (Of course, when he changes information, the questions coming in the coming forms may or may not change)

Now the question is, please answer, does iOS keep all the form data in the memory or write onto some temporary memory and retrieve it back? How does the iOS manager to show the data on the previous view's data?

Thank yoU!

Chandu
  • 630
  • 2
  • 8
  • 18

1 Answers1

0
  1. When you add ViewControllers to the NavigationController the navigation stacked get filled.

  2. The UINavigationController will keep the added view controllers in memory until the view controllers are removed. (poped from navigation controller)

  3. So if you are going back to a view controller in the middle of the stack there's a chance that the view controllers which are added lsat being removed and you will loose the data.

  4. Best way to handle this would be to persist data or create a model object and pass it around .

This is for iOs 6 / 7 , If you are supporting iOS 5 then views can be unloaded on receiving "didReceiveMemoryWarning" then you will loose your data. So do not store your data in view objects use models or persist them

rustylepord
  • 5,681
  • 6
  • 36
  • 49
  • Is it possible to change the stack order that iOS maintains? – Chandu Apr 04 '14 at 19:21
  • A UINavigationController keeps the viewControllers in an array. You can access this by "viewControllers" property in UINavigationController. Then change the order of the elements in the array as you want and set it back . Something similar to this . http://stackoverflow.com/questions/8627050/replace-a-uiviewcontroller-in-the-uinavigationcontroller-hierarchy – rustylepord Apr 09 '14 at 12:51