It's quite simple. What you need to do is create a UIWindow
with UIWindowLevelStatusBar
level. This will overlap the status bar. Here is sample code:
UIWindow *window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
window.windowLevel = UIWindowLevelStatusBar;
window.backgroundColor = [UIColor colorWithWhite:0.0f alpha:0.7f];
[window makeKeyAndVisible];
You can add views to this window. They can even overlap the status bar. Remember to store a reference to the new window otherwise it will be deallocated.
If you want to control the status bar appearance, or get information about rotation events you should create a UIViewController
and set it as a rootViewController
of your winndow. Then if you want to change the status bar style to light, add this code in the view controller:
- (UIStatusBarStyle)preferredStatusBarStyle
{
return UIStatusBarStyleLightContent;
}