美文网首页
遮住状态栏

遮住状态栏

作者: mnz12138 | 来源:发表于2017-09-22 16:07 被阅读0次
    UIView *statusView = [[UIView alloc] initWithFrame:[[UIApplication sharedApplication] statusBarFrame]];
    statusView.backgroundColor = [UIColor blackColor];
    UIWindow *wd = [self mainWindow];
    //添加遮盖视图
    [wd addSubview:statusView];
    //修改窗口等级
    wd.windowLevel = UIWindowLevelAlert;
    /**
     获取window
     */
    - (UIWindow*)mainWindow{
        UIApplication *app = [UIApplication sharedApplication];
        if ([app.delegate respondsToSelector:@selector(window)]) {
            return [app.delegate window];
        } else {
            return [app keyWindow];
        }
    }
    

    相关文章

      网友评论

          本文标题:遮住状态栏

          本文链接:https://www.haomeiwen.com/subject/cxufextx.html