IOS: save an uimage when I press home button
-
07-06-2021 - |
Pergunta
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?
Solução
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
Outras dicas
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