Reputation: 1173
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):
In the xib I've set all options of top bar to inferred:
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.
Upvotes: 0
Views: 182
Reputation: 712
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.
Upvotes: 2
Reputation: 5039
Select your View in xib and the go to attribute inspector
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.
Upvotes: 0
Reputation: 1173
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
Upvotes: 0