Search code examples
iosuiimagehome-directory

IOS: save an uimage when I press home button


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?


Solution

  • 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