gpt4 book ai didi

ios - 用DidBecomeActive通知区分通知中心隐藏和后台返回

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:20:59 25 4
gpt4 key购买 nike

我对 UIApplicationDidBecomeActiveNotification 感到困惑。我可以为此通知注册一个观察者,并在应用程序从后台激活或启动时接收信号。但是,当我下拉隐藏的顶部弹出 View (一般信息:通知、天气、股市)然后向上拉以隐藏它时,也会生成信号。我使用与此信号 Hook 的回调方法来刷新我的应用程序,因此这对我的应用程序的用户来说可能很烦人。

谁能帮我区分这些情况?

最佳答案

也许你应该试试 UIApplicationWillEnterForegroundNotification,苹果文档说: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplication_Class/Reference/Reference.html

UIApplicationDidBecomeActiveNotification: Posted when the application becomes active.

An application is active when it is receiving events. An active application can be said to have focus. It gains focus after being launched, loses focus when an overlay window pops up or when the device is locked, and gains focus when the device is unlocked.

关于ios - 用DidBecomeActive通知区分通知中心隐藏和后台返回,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18139417/

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