简体   繁体   English

iPhone应用程序上的动画关闭,如相机应用程序上的快门

[英]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. 我希望我的应用在关闭之前做一个动画,就像Apple的官方Camera应用一样,在关闭自身之前先“关闭快门”。 Is is possible or is this a private and undocumented API? 是否可能,或者这是私有且未记录的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. 我不能肯定地告诉您任何UI东西都可以使用,但是可以尝试的地方在您的UIApplicationDelegate(AppDelegate)类中。 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. 我假设UI将随着应用程序窗口的动画而改变。 Let us know if it works! 让我们知道它是否有效!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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