gpt4 book ai didi

ios - 处理任务过程中中断(例如电话、电池警告)的最佳方法

转载 作者:行者123 更新时间:2023-11-29 03:47:55 24 4
gpt4 key购买 nike

我知道 here 所描述的方法与 applicationWillResignActive:,但这是应用程序委托(delegate)中的一个方法。如果我在一个明显独立的 View Controller 中执行任务,我如何告诉该 View Controller 从应用程序委托(delegate)中暂停其事件?

最好是通过委托(delegate)来完成此操作吗?或者还有另一种更优选的方式吗?

最佳答案

对于需要它的 View Controller ,您可以使它们成为应用程序通知的观察者。有一系列通知,例如 UIApplicationWillResignActiveNotificationUIApplicationWillEnterForegroundNotification,它们都发布到 defaultCenter (NSNotificationCenter)。

关于ios - 处理任务过程中中断(例如电话、电池警告)的最佳方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17474374/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com