ios - 如何使用自定义 UIWindow 来覆盖 sendEvent 函数?
问题描述
SNWindow是我使用自定义委托创建的自定义类,它覆盖了sendEvent函数。
在以前的 iOS 版本中(没有 SceneDelegate 时),我曾经在 AppDelegate.h 中插入此代码:
@property (strong, nonatomic) SNWindow *window;
AppDelegate.m 中的这段代码:
- (SNWindow *)window {
static SNWindow *window = nil;
if (!window) {
window = [[SNWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
}
return window;
}
而 ViewController.m 中的这段代码:
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
appDelegate.window.delegate = self;
appDelegate.window.view = self.view;
}
不幸的是,这不再起作用了。我尝试更改 SceneDelegate 的 UIWindow 但屏幕上没有加载任何内容,只是黑屏。
解决方案
推荐阅读
- raspberry-pi - 在本地网络网站中使用 Google OAuth
- arrays - 在打字稿中将数据从一行重复到另一行
- javascript - 在其自身之后克隆节点(不在任何地方......)
- flutter - 如何在颤动中将TextFormField定位到屏幕底部
- ios - 查找我的设备(例如 AirTag)是否知道它们何时被 ping 通?
- javascript - 警告:道具“数据回调”的值无效标签。从元素中删除它,或者传递一个字符串或数字值以将其保留在 DOM 中
- function - 如何在 kotlin 中为泛型类型的 CloseRanged 编写迭代器?
- c# - 过滤 WinForms 文本框输入
- javascript - MongoDB find $and with value of any
- c - vscode上的“拒绝访问”c程序