0

Here you can see, that the status bar is above the black background. How to put status bar under it? Like you can see the navigation bar is.

enter image description here

I need to get something like this: enter image description here

Popeye
  • 11,839
  • 9
  • 58
  • 91
user2058653
  • 703
  • 2
  • 9
  • 23
  • Unheilig, it isn't this! I don't have problems with my status bar and navigation bar (Autolayout) I want put black background programmatically above all view including status bar, like notification bar! – user2058653 Dec 22 '13 at 16:16

2 Answers2

3

this is possible if you create new window and add that view to it. Make a window property in your ViewController as shown below

@property (nonatomic,strong) UIWindow *window;

And write below code in viewDidLoad

self.window =[[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
self.window.backgroundColor =[UIColor blueColor];
self.window.alpha =0.5;
UIView *view =[[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
view.backgroundColor =[UIColor greenColor];
[self.window addSubview:view];
self.window.hidden =NO;
self.window.windowLevel =UIWindowLevelStatusBar; // it works with window level as UIWindowLevelAlert
[self.window makeKeyAndVisible];

Hope this helps.

santhu
  • 4,796
  • 1
  • 21
  • 29
0

Try this code:

[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];

This will hide the status bar.

See the whole post here

Community
  • 1
  • 1
adeiji
  • 550
  • 1
  • 3
  • 13