iOS APP 中查找显示在最上面的、全屏的、可见的 window（大部分情况都适用）

ripperhe
2018-09-18T05:29:39Z

ZYWindowManager.m

| - (UIWindow *)topFullScreenVisibleWindow
| {
| NSArray *windows = [UIApplication sharedApplication].windows;
| for (UIWindow *window in windows.reverseObjectEnumerator) {
| if (window.hidden == YES || window.opaque == NO) {
| continue;
| }
| if (CGRectEqualToRect(window.bounds, [UIScreen mainScreen].bounds) == NO) {
| continue;
| }
| return window;
| }
| if ([UIApplication sharedApplication].keyWindow) {
| return [UIApplication sharedApplication].keyWindow;
| }
| if ([[UIApplication sharedApplication].delegate respondsToSelector:@selector(window)]) {
| return [UIApplication sharedApplication].delegate.window;
| }
| return nil;
| }