1

I need to show UIView with full screen mode above NavigationBar and StatusBar How i can do that?


P.S. Sorry for my English

View above NavigationBar and StatusBar

Lion Gurman
  • 161
  • 1
  • 2
  • 9

2 Answers2

4

The below code will help you with that. You can change the color to your desired color to achieve the desired affect.

UIWindow *window = [[[UIApplication sharedApplication] delegate] window];

UIView *blue = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[blue setBackgroundColor:[UIColor blueColor]];
[window addSubview: blueView];

Swift Code:

if let applicationDelegate:AppDelegate = UIApplication.shared.delegate as! AppDelegate? {
   if let window:UIWindow = applicationDelegate.window {
      let blueView:UIView = UIView(frame: UIScreen.main.bounds)
      blueView.backgroundColor = UIColor.blue.withAlphaComponent(0.75)
      window.addSubview(blueView)
   }
}
KrishnaCA
  • 5,615
  • 1
  • 21
  • 31
  • 1
    @Eric Aya I added the swift version of the code. Thanks for suggestion :). Feel free to comment if there's anything more that can be done – KrishnaCA Oct 25 '16 at 15:28
0

You might want to take a look at this persons answer.

How to make a UIView that can cover the navigation bar?

Basically, instead of setting your 2nd view as a subview of your main view, set the 2nd view as a subview of your navigation controller.

Cyril
  • 2,783
  • 1
  • 24
  • 35