Pergunta

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

Foi útil?

Solução

Just use:

[self.navigationController popToRootViewControllerAnimated:NO];

Hope that Helps!

Outras dicas

hope Following link will help...

How are people popping their UINavigationController stacks under a UITabBarController?

You can keep a reference or Current navigation controller in your appdelegate OR you can write this in you viewDidUnload OR viewWillDisapper for popping navigation to root when application goes to background.

You could just compare the view against your main view if you have a reference hanging around:

while (self.view != myMainView)

etc. (Assuming that self.view is the correct reference as well.)

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top