UIWindow删除iOS9.1中的错误

时间:2015-11-06 09:22:41

标签: ios uiwindow ios9.1

在iOS9.1中,当我通过removeFromSuperView删除自定义UIWindow并设置为nil时,它在自动点击窗口之前不会自动消失。和

显示错误
  _UIApplicationHandleEventFromQueueEvent中的

意外的nil窗口,   _windowServerHitTestWindow :( null)

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

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

1 个答案:

答案 0 :(得分:1)

我用代码解决了问题

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

- (void)makeKeyAndVisible方法注释

  

便利性。大多数应用程序调用它来显示主窗口并将其设为关键。否则使用视图隐藏属性