我试图在ios9的状态栏上方查看一个视图:
UIWindow *statusWindow = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
statusWindow.windowLevel = UIWindowLevelStatusBar + 1;
statusWindow.hidden = NO;
statusWindow.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.7];
[statusWindow setRootViewController:self];
[statusWindow makeKeyAndVisible];
我只会看到黑屏,其中没有覆盖状态栏。知道为什么它不起作用吗?
最佳答案
我将继续进行,并假设您基于此线程编写代码:
Add UIView Above All Other Views, Including StatusBar
话虽这么说,你为什么要设置:
statusWindow.windowLevel = UIWindowLevelStatusBar + 1;
它应该是:
statusWindow.windowLevel = UIWindowLevelStatusBar;
将来,请添加对您所查看的所有线程的引用。
祝好运!
关于ios - 在状态栏上方查看,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/33244580/