iOS 获取当前window

 1 //获取当前window
 2 + (UIWindow *)mainWindow
 3 {
 4     UIApplication *app = [UIApplication sharedApplication];
 5     if ([app.delegate respondsToSelector:@selector(window)])
 6     {
 7         return [app.delegate window];
 8     }
 9     else
10     {
11         return [app keyWindow];
12     }
13 }

 

posted @ 2017-03-23 10:22  福泽小院  阅读(8440)  评论(0编辑  收藏  举报