0

I'm trying to add an overlay view (addSubview) and have it "extend" the status bar + navigationBar

So I made a xib that has a red view, with a constraint of Top alignment of 64.

Still I have black line between the status bar and the red view (see image)

If I change the constraint to less - the red view in under the status bar, but still there is a black line.

The code that adds the view:

    overlaySearchView = [[[NSBundle mainBundle] loadNibNamed:@"searchView" owner:self options:nil] objectAtIndex:0];
    overlaySearchView.frame = [[UIScreen mainScreen] bounds];
//    overlaySearchView.frame = self.view.bounds; //tried both


    [[self view] addSubview:overlaySearchView];

enter image description here

Boaz
  • 4,864
  • 12
  • 50
  • 90

3 Answers3

1

See answer here: How to hide iOS7 UINavigationBar 1px bottom line

What you are seeing is the shadow of the navigation bar, rather than a gap between the two views.

Community
  • 1
  • 1
rstewart22
  • 222
  • 1
  • 8
0

please select the view controller and in attribute inspector tab check/uncheck

  1. under top bars and
  2. under bottom bar options

Hope it helps!

ZAZ
  • 597
  • 3
  • 6
  • yes i know, but this view will be in a viewcontroller :-) select the viewcontroller and give it a try. – ZAZ Oct 19 '14 at 19:44
  • Under Top Bars and Under Opaque Bars in the original ViewController is checked... – Boaz Oct 19 '14 at 19:50
  • exactly the same (after unchecking it and changing the constraint to 0) - nice try... – Boaz Oct 19 '14 at 20:18
  • add top contraint for the overlay view then, hope it will do the trcik. – ZAZ Oct 19 '14 at 20:29
0

What about trying to modify your self.navigationController.navigationBar.frame.size.height?

If that works you can then add a custom navigationItem.titleView with all your other views in it.

Rivera
  • 10,792
  • 3
  • 58
  • 102