【源码】iOS获取UIWindow

这种有时候不行:

    UIWindow *window =  [[UIApplication sharedApplication] keyWindow];

下面这些任何情况都可以:

    UIWindow *window = [[UIWindow  alloc]initWithFrame:[UIScreen mainScreen].bounds];

    UIWindow *window =[[UIApplication sharedApplication].delegate window];

    UIWindow *window = [[[UIApplication sharedApplication] delegate] window];

    UIWindow *window = [UIApplication sharedApplication].windows[0];

posted @ 2016-07-29 00:48  王彬iOS  阅读(1675)  评论(0编辑  收藏  举报