gpt4 book ai didi

ios - UIWindow keyWindow 更改通知

转载 作者:行者123 更新时间:2023-11-29 12:33:15 40 4
gpt4 key购买 nike

我正在创建一个越狱调整,向 UIWindow 添加一个 View ,无论当前的 keyWindow 是什么。问题是每当 keyWindow 发生变化时, View 就会被删除。

我在用这个

%hook SBApplication
-(void)willActivate {
UIWindow *window = [[UIApplication sharedApplication] keyWindow];
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0,320,53)];
view.backgroundColor = [UIColor greenColor];
[window addSubview:view];
}
%end

有没有其他方法更适合在这里使用,或者是否有在窗口更改时发送的通知?

最佳答案

是的,您可以观察到一条通知:

UIWindowDidBecomeKey

Posted whenever a UIWindow object becomes the key window. The notification object is the window object that has become key. This notification does not contain a userInfo dictionary.

More in the docs.

关于ios - UIWindow keyWindow 更改通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27007482/

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