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];
}
}
网友评论