Boaz
Boaz

Reputation: 5084

overlay view not tight on the UINavigationBar

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

Upvotes: 0

Views: 214

Answers (3)

rstewart22
rstewart22

Reputation: 222

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.

Upvotes: 1

E. Rivera
E. Rivera

Reputation: 10938

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.

Upvotes: 0

ZAZ
ZAZ

Reputation: 593

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!

Upvotes: 0

Related Questions