Search code examples
iphonebackgroundpopviewcontrollerbackground-foreground

pop one or more viewControllers when app enters in foreground


My app downloads data from internet when it starts, during the splash screen. It does the same when, from the background, it enters in foreground (when the user open the app from the background).

When the app is open, the user can push some views in order to read the informations downloaded.

I want that when the app is open from the background state, the viewControllers are popped until the first view is showed... I want to do something like this in my AppDelegate:

while ([self.view isNotMainView]) //of course this method doesn't exists
     { [self.navigationController popViewControllerAnimated:NO]; }

is it possible?

Thanks


Solution

  • Just use:

    [self.navigationController popToRootViewControllerAnimated:NO];
    

    Hope that Helps!