In 14.1 and earlier versions, clicking the custom window will not automatically become the keywindow. Why does 14.2, touching the custom window, it will become the keywindow?
Why? In 14.1 and earlier versions, clicking the custom window will not automatically become the keywindow. Why does 14.2, touching the custom window, it will become the keywindow?
Code Block language @interface DebugWindow : UIWindow @end @implementation DebugWindow - (void)makeKeyWindow { [super makeKeyWindow]; NSLog(@"%s", FUNCTION); } - (void)resignKeyWindow { [super resignKeyWindow]; NSLog(@"%s", FUNCTION); } - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event { [super touchesBegan:touches withEvent:event]; NSLog(@"%s", FUNCTION); } @end @interface ViewController () @property (nonatomic, strong) DebugWindow *window; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; DebugWindow *window = [[DebugWindow alloc] initWithFrame:self.view.bounds]; window.windowScene = [UIApplication sharedApplication].keyWindow.windowScene; window.backgroundColor = UIColor.redColor; window.center = self.view.center; window.hidden = NO; self.window = window; } - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event { [super touchesBegan:touches withEvent:event]; NSLog(@"%s", FUNCTION); } @end
Why? In 14.1 and earlier versions, clicking the custom window will not automatically become the keywindow. Why does 14.2, touching the custom window, it will become the keywindow?