How do I make my iPhone app start at the same place each time, i.e. my 'home' screen? I do NOT want the user to return to where they were last time they played - right in the middle of gameplay - but that's what's happening. Thanks in advance for any tips!
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- how do you prevent page scroll in textarea on mobi
- Custom UITableview cell accessibility not working
相关文章
- Could I create “Call” button in HTML 5 IPhone appl
- Unable to process app at this time due to a genera
- How do you detect key up / key down events from a
- “Storyboard.storyboard” could not be opened
- Open iOS 11 Files app via URL Scheme or some other
- Can keyboard of type UIKeyboardTypeNamePhonePad be
- Can not export audiofiles via “open in:” from Voic
- XCode 4.5 giving me “SenTestingKit/SenTestKit.h” f
This is presumably only happening because your app isn't really being stopped - it's simply being backgrounded. (If you double click the home button whilst viewing springboard does it show up at the bottom? If so, it's still running.)
You can disable this behaviour (so your app quits when the user hits the home button) by setting the
UIApplicationExitsOnSuspend
key (known as "Application does not run in background" within Xcode) in your info.plist file. See Apple's Information Property List Key Reference docs for more information.Alternatively, you could simply capture the
applicationDidEnterBackground:
UIApplicationDelegate method in your app's add delegate and handle the situation from there programatically. (i.e.: Do whatever you need to do to reset your app back to the 'home' screen, etc.)Set
UIApplicationExitsOnSuspend
toYES
int theInfo.plist
./* Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. */
You need to set the
UIApplicationExitsOnSuspend
key in your info.plist file toYES
. Then the app will quit when the home button is pressed, and launch fresh when it is opened again.