0

In my app I should color some images but I have a problem

I have three viewcontroller, and I save my image in NShomedirectory/documents

When I color I'm in thirdViewController, when I change image with an IBAction I save it in NSHomedirectory, but if I'm coloring an image and I press home button , my image is not saved when I open a second time my app; (my app is not multitasking for some reason) is there a way to intercep home button press?

cyclingIsBetter
  • 17,447
  • 50
  • 156
  • 241

2 Answers2

0

Following method is called when your app goes to background.

- (void)applicationDidEnterBackground:(UIApplication *)application

you can have image saving code in this method.

Check this link for more details - UIApplicationDelegate

rishi
  • 11,779
  • 4
  • 40
  • 59
  • What's the real difference with applicationWillResignActive ? cause in the link they said that it's also when the application become inactive :/ – John Smith May 11 '12 at 09:08
  • @JohnSmith - you can check this link for details - http://stackoverflow.com/questions/3712979/applicationwillenterforeground-vs-applicationdidbecomeactive-applicationwillre – rishi May 11 '12 at 09:12
  • Okay thanks, then it's better for him to use applicationDidEnterBackground cause he wants do data saving – John Smith May 11 '12 at 09:24
0

yes

In your AppDelegate you can overload this:

- (void)applicationWillResignActive:(UIApplication *)application;

your application enter in this function each time you click on the home button

John Smith
  • 1,194
  • 1
  • 12
  • 30