|
|
|
|
30
|
[overlayWindow setHidden:YES];
|
30
|
[overlayWindow setHidden:YES];
|
31
|
[overlayWindow setRootViewController:nil];
|
31
|
[overlayWindow setRootViewController:nil];
|
32
|
[overlayWindow resignKeyWindow];
|
32
|
[overlayWindow resignKeyWindow];
|
|
|
33
|
+ [self assignKeyWindow];
|
33
|
[_overlayWindows removeObject:overlayWindow];
|
34
|
[_overlayWindows removeObject:overlayWindow];
|
34
|
}
|
35
|
}
|
35
|
|
36
|
|
|
|
37
|
+- (void)assignKeyWindow {
|
|
|
38
|
+ NSArray* windows = [[[UIApplication sharedApplication].windows reverseObjectEnumerator] allObjects];
|
|
|
39
|
+ for (UIWindow* window in windows) {
|
|
|
40
|
+ if (window.rootViewController) {
|
|
|
41
|
+ [window makeKeyAndVisible];
|
|
|
42
|
+ return;
|
|
|
43
|
+ }
|
|
|
44
|
+ }
|
|
|
45
|
+}
|
|
|
46
|
+
|
36
|
- (UIWindow *)findWindowByRootViewController:(UIViewController *)viewController {
|
47
|
- (UIWindow *)findWindowByRootViewController:(UIViewController *)viewController {
|
37
|
for (UIWindow* window in _overlayWindows) {
|
48
|
for (UIWindow* window in _overlayWindows) {
|
38
|
if ([window.rootViewController isEqual:viewController]) {
|
49
|
if ([window.rootViewController isEqual:viewController]) {
|