简体   繁体   中英

Animation on iPhone app closing, like the shutter on camera app

I'd like my app to do an animation just before close, exactly like the official Camera app from Apple, that "closes the shutter" before closing itself. Is is possible or is this a private and undocumented API?

Thank you in advance!

There is no official way for your app to delay its closing after the user taps the home button. Apple wants users to be able to quit out of apps quickly and at anytime. However, you do get notified when your app is closing, and you do get a chance to run some code. I can't tell you for sure of any UI stuff would work, but the spot to try it is in your UIApplicationDelegate (AppDelegate) class. The methods you're interested in are:

- (void)applicationWillResignActive:(UIApplication *)application {
    // Try some UI stuff here
}

Or:

- (void)applicationDidEnterBackground:(UIApplication *)application {

}

I'm assuming the UI will change as the app window is animating away. Let us know if it works!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM