简体   繁体   中英

How do I force my ios7 app to start on the home screen?

I have an app with multiple View Controllers. I have a Home screen with "Play / Options / etc.". When you hit Play, you navigate over to the GamePlay View Controller and start playing.

I find that if I'm in the "gameplay" VC and I hit the iPhone's Home button (leaving my app) and then re-launch my app, it puts me right back to the game screen. I'd like to force the app to start on the same "Home" screen every time is it launched.

Suggestions greatly appreciated!

Thanks,

-Ed

in your app's plist add the key UIApplicationExitsOnSuspend and set it to YES . Your app wont be suspended and youll always start on the home screen

When you press the Home button, the application goes to background. When launched again, application just enters foreground from background. I think you can load the home screen in the following delegate method in AppDelegate

- (void)applicationWillEnterForeground:(UIApplication *)application

You can preserve the state of the game (I don't want to kill that zombie again!) in the following:

- (void)applicationDidEnterBackground:(UIApplication *)application

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