Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法检测用户何时两次点击主页按钮以在后台关闭应用程序?
此方法让您的应用程序知道它即将被终止并完全从内存中清除
- (void)applicationWillTerminate:(UIApplication *)application { // Saves changes in the application's before the application terminates. }
但是是的,当您从主页按钮关闭时,它不会在后台调用。
有关更多信息,请通过文档https://developer.apple.com/library/ios/documentation/uikit/reference/UIApplicationDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intfm/UIApplicationDelegate/applicationWillTerminate: