0

I've created MyViewController in separate xib and pushed it to navigation stack. It is loaded properly and resizing, but hides below the displayed navigation bar (green button hidden): enter image description here In the xib I've set all options of top bar to inferred:

enter image description here

How can I solve it? Of course I can manually add spacing in the xib, but it's just not the right way.

EDIT: In xib's attributes I don't see extend under Top Bar tick, since in xib I have created UIView with file owner set to MyViewController.

enter image description here

enter image description here

izik461
  • 1,131
  • 12
  • 32

3 Answers3

2

It is because of translucent. You should do this.

self.navigationController?.navigationBar.isTranslucent = false

And you'll see it works. When the navigation bar is not translucent, xib can't locate behind the navigation bar to show what it has.

AtaerCaner
  • 691
  • 7
  • 12
0

I've managed with changing edgesForExtendedLayout property programatically in viewDidLoad:

self.edgesForExtendedLayout = UIRectEdgeRight | UIRectEdgeLeft | UIRectEdgeBottom;

With some help from question: How to set UIViewController "extend edges" properties

Community
  • 1
  • 1
izik461
  • 1,131
  • 12
  • 32
0

Select your View in xib and the go to attribute inspector

enter image description here

and select top Bar as shown in screenshot and then design your screen accordingly. It gives you an idea about how much space will your navigation bar take.

Umair Afzal
  • 4,947
  • 5
  • 25
  • 50