哪个事件当我关闭应用程序在iOS? [英] Which Event When i close app in iOS?

查看:87
本文介绍了哪个事件当我关闭应用程序在iOS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在iOS中关闭我的应用程序时执行事件,如下图所示。





当我用减号按钮关闭应用程序时,我想要捕获该事件。



我需要做哪个事件?

解决方案

即将终止。

   - (void)applicationWillTerminate:(UIApplication *)app 
{
}

如果您使用iOS 4或更高版本并支持多任务, applicationWillTerminate $



要接收终止事件,您需要添加 UIApplicationExitsOnSuspend info.plist



检查此 文章 。 >




I need to implement event when i close my app in iOS like following pic.

I want to catch that event when i close app with that minus button.

Which event i need to do?

解决方案

This delegete will be called when your application is going to terminate.

- (void)applicationWillTerminate:(UIApplication *)app
{
}

If you are using iOS 4 or greater and with multi-tasking support, applicationWillTerminate will not be called.

For receiving the terminate event you need to add UIApplicationExitsOnSuspend key on your info.plist

Check this article for a good understanding about application events.

这篇关于哪个事件当我关闭应用程序在iOS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆