ios – 当调用applicationDidBecomeActive时?

ios – 当调用applicationDidBecomeActive时?,第1张

概述有人解释什么时候调用applicationDidBecomeActive方法???这个方法的目的是什么?  当调用applicationDidBecomeActive方法时? 了解iOS的状态和转换 状态 非运行 – 应用程序未运行. 非活动 – 应用程序在前台运行,但未接收事件.可以将iOS应用程序置于非活动状态,例如,当收到呼叫或SMS消息时. 活动 – 应用程序在前台运行,并接收事件. 背景 有人解释什么时候调用applicationDIDBecomeActive方法???这个方法的目的是什么?
当调用applicationDIDBecomeActive方法时?解决方法 了解iOS的状态和转换

状态

非运行 – 应用程序未运行.

非活动 – 应用程序在前台运行,但未接收事件.可以将iOS应用程序置于非活动状态,例如,当收到呼叫或SMS消息时.

活动 – 应用程序在前台运行,并接收事件.

背景 – 应用程序在后台运行,并执行代码.

暂停 – 应用程序在后台,但没有正在执行的代码.

七个最重要的应用程序委托方法

The operating system calls specific methods within the application delegate to facilitate Transitioning to and from varIoUs states. The seven most important application delegate methods a developer should handle are:

应用:willFinishLaunchingWithOptions

Method called when the launch process is initiated. This is the first opportunity to execute any code within the app.

应用中:dIDFinishLaunchingWithOptions

Method called when the launch process is nearly complete. Since this method is called is before any of the app’s windows are displayed,it is the last opportunity to prepare the interface and make any final adjustments.

applicationDIDBecomeActive

Once the application has become active,the application delegate will receive a callback notification message via the method applicationDIDBecomeActive.

This method is also called each time the app returns to an active state from a prevIoUs switch to inactive from a resulting phone call or SMS.

applicationWillResignActive

There are several conditions that will spawn the applicationWillResignActive method. Each time a temporary event,such as a phone call,happens this method gets called. It is also important to note that “quitting” an iOS app does not terminate the processes,but rather moves the app to the background.

applicationDIDEnterBackground

This method is called when an iOS app is running,but no longer in the foreground. In other words,the user interface is not currently being displayed. According to Apple’s UIApplicationDelegate Protocol Reference,the app has approximately five seconds to perform tasks and return. If the method does not return within five seconds,the application is terminated.

applicationWillEnterForeground

This method is called as an app is preparing to move from the background to the foreground. The app,however,is not moved into an active state without the applicationDIDBecomeActive method being called. This method gives a developer the opportunity to re-establish the settings of the prevIoUs running state before the app becomes active.

applicationWillTerminate

This method notifIEs your application delegate when a termination event has been triggered. Hitting the home button no longer quits the application. Force quitting the iOS app,or shutting down the device triggers the applicationWillTerminate method. This is the opportunity to save the application configuration,settings,and user preferences.

需要额外的信息参考这个link1或苹果link2

总结

以上是内存溢出为你收集整理的ios – 当调用applicationDidBecomeActive时?全部内容,希望文章能够帮你解决ios – 当调用applicationDidBecomeActive时?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1103820.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-28
下一篇 2022-05-28

发表评论

登录后才能评论

评论列表(0条)

保存