开发者

how to restart a application without going to recent worked page ,when we exit in ipad

I had installed my app on ipad(ios 4) , and i was navigating through the pages of my app.whenever i close the app and re open the app it goes back to the recent page which i was working on. But i want it to restart the app from first page,whenever i exit and reopen .As it is working on iphone(ios 3.1.3),Can any one suggest how 开发者_开发问答to do that on ipad.

thanks in advance


I think you can do that easily. You need to set info.plist key "Application does not run in background" to YES and it will no longer to run in background.

how to restart a application without going to recent worked page ,when we exit in ipad


When application enters background the delegate method appDidEnterBackground is called and when resumed the method willEnterForeGround will be called.

You can handle your application behaviour in these methods.

For more info you can refer to this link which explains the concepts beautifully.


On iOS 4 the app does not exit it goes to background. And when you tap on the icon the app resumes from where you left it.

If you want to reset something when it goes in background you need to implement custom code in appDelegate methods:

- (void)applicationDidEnterBackground:(UIApplication *)application
{
    /*
     Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 
     If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
     */
}
- (void)applicationWillEnterForeground:(UIApplication *)application
{
    /*
     Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
     */
}


You need to set UIApplicationExitsOnSuspend to yes in your info.plist


Which methods are called when user presses home button and double presses it again to return

here you can find answer to event on clicking on home button interesting article


Find your info.plist file in resources and add the key: "Application does not run in background" and set the value to 1.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜