简体   繁体   English

如何在 iPhone 应用程序重新打开时调用方法

[英]How to call a method upon iPhone app re-opening

I have a method that I want to call not the first time the app launches from being not open at all, but whenever the app opens at all, whenever.我有一个方法,我不想在应用程序第一次从根本未打开状态启动时调用该方法,而是在应用程序打开时调用。 So if the app is open, then the user closes it, but it is still running through multitasking, I want to the method to run when they resume the app as well.因此,如果应用程序已打开,则用户将其关闭,但它仍在通过多任务处理运行,我希望该方法也能在他们恢复应用程序时运行。

applicationWillEnterForeground:

In iOS 4.0 and later, this method is called as part of the transition from the background to the active state.在 iOS 4.0 及更高版本中,此方法作为从后台到活动状态转换的一部分被调用。 Specifically, it is not called when the application is launched for the first time -- which is what you are looking for.具体来说,当应用程序第一次启动时它不会被调用——这正是您要寻找的。

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

}

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

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