3

在 iOS9.1 中,当我通过 removeFromSuperView 删除自定义 UIWindow 并将其设置为 nil 时,它不会自动消失,直到单击该窗口。并显示错误

_UIApplicationHandleEventFromQueueEvent、_windowServerHitTestWindow 中的意外零窗口:(空)

在 iOS9 及更低版本中,它可以正常工作。

UIWindow *window = [target associatedValueForKey:lock_window];
if (window) [window removeFromSuperview];
[target associateValue:nil withKey:lock_window];
4

1 回答 1

1

我已经用代码解决了问题

UIWindow *window = [target associatedValueForKey:lock_window];
if (window) [window removeFromSuperview];
window.hidden = YES;
[target associateValue:nil withKey:lock_window];

- (void)makeKeyAndVisible方法注释是

方便。大多数应用程序调用它来显示主窗口并使其成为关键。否则使用查看隐藏属性

于 2015-11-06T09:44:11.260 回答