查看状态栏上方

我正在尝试在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]; 

我只得到一个状态栏未覆盖的黑屏。 知道为什么它不起作用吗?

我将继续并假设您正在编写基于此线程的代码:

将UIView添加到所有其他视图之上,包括StatusBar

话虽如此,你为什么要设置:

 statusWindow.windowLevel = UIWindowLevelStatusBar + 1; 

它应该是:

 statusWindow.windowLevel = UIWindowLevelStatusBar; 

将来,请添加对您查看的任何线程的引用。

祝你好运!

我发现了这个: https : //github.com/kevingibbon/KGStatusBar它工作得很好。 这是我发现的唯一一个与iOS9一起使用的框架。