gpt4 book ai didi

ios - 如果用户向上滚动控制中心,如何从 iOS 键盘扩展检测到?

转载 作者:行者123 更新时间:2023-11-30 14:10:52 26 4
gpt4 key购买 nike

我开发了一个 iOS 键盘扩展,并且我在键盘上使用滚动手势。有时,当使用键盘时,我向上滚动控制中心,但键盘无法正常工作。有什么方法可以检测控制中心是否可见或不可见?

最佳答案

你不能直接这样做。您最多可以知道的是您的应用程序被停用然后再次激活。可能是因为控制中心,可能是因为通知中心,可能是因为有电话打进来,可能是因为用户进入应用程序切换器然后又回来了......

以下是您可以尝试的可能解决方法:

It is the UIWindow subclass to enable behavior like adaptive round-corners & detecting when Control Center is opened. This UIWindow subclass does probably the thing you want. You simply subscribe to an NSNotification and can react to the user opening Control Center. Detailed instructions and setup on Github

https://github.com/aaronabentheuer/AAWindow

[AAWindow: The way this is accomplished is by using a combination of NSTimer and overwriting sendEvent in UIWindow to receive all touches without blocking them. So you basically receive all touches check if they are near the lower edge of the screen, if yes set a timer for a half a second and if during this timer is running applicationWillResignActive is called you can be almost certain that ControlCenter is opened. The time has to vary if there's no statusbar, because then the app is in fullscreen and it can take the user up to 3 seconds to launch Control Center.]

希望它能帮助您找到问题的确切解决方案。

关于ios - 如果用户向上滚动控制中心,如何从 iOS 键盘扩展检测到?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31785136/

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