当我用UIView覆盖所有屏幕时,如何用UIView覆盖UIStatusBar? (苹果手机) [英] How to cover also the UIStatusBar with UIView when i cover all the screen with the UIView? (iPhone)

查看:170
本文介绍了当我用UIView覆盖所有屏幕时,如何用UIView覆盖UIStatusBar? (苹果手机)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我用UIView覆盖所有屏幕时,如何用UIView覆盖UIStatusBar?

How to cover also the UIStatusBar with UIView when i cover all the screen with the UIView?

推荐答案

我正在如何战斗这样做很长一段时间了!最后想出来:)关键是将新窗口的windowLevel设置为非常高,以便它位于所有其他窗口/视图/状态栏等之上:

I was battling how to do this for a long time too! Finally figured it out :) The key is to set the windowLevel of your new window to really high so it lives on top of all the other windows/views/statusbar etc:

UIWindow *keyWin = [UIApplication sharedApplication].keyWindow;
UIWindow *hudWindow = [[UIWindow alloc] initWithFrame:CGRectMake(0.0f, 0.0f, keyWin.frame.size.width, keyWin.frame.size.height)];
hudWindow.backgroundColor = [UIColor blackColor];
hudWindow.alpha = 0.60;
[hudWindow setWindowLevel:10000.0f];
[hudWindow setHidden:NO];

享受!

这篇关于当我用UIView覆盖所有屏幕时,如何用UIView覆盖UIStatusBar? (苹果手机)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆