简体   繁体   中英

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

Just use:

[self.navigationController popToRootViewControllerAnimated:NO];

Hope that Helps!

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.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM