获取window

- (UIWindow *)lastWindow

{

NSArray *windows = [UIApplication sharedApplication].windows;

for(UIWindow *window in [windows reverseObjectEnumerator]) {

if ([window isKindOfClass:[UIWindow class]] &&

CGRectEqualToRect(window.bounds, [UIScreen mainScreen].bounds))

return window;

}

return [UIApplication sharedApplication].keyWindow;

}

你可能感兴趣的:(获取window)