Biscuit128
Biscuit128

Reputation: 5398

Navigation Bar Not Fitting Full Width

I am trying to get a navigation bar to stretch across the whole width of the screen when in portrait and landscape. To do this I added some constraints for the right and left border to be 0 pixels indent as follows;

enter image description here

However, this seems to still be failing and when I look at the view after changing there is an indent as can be seen in the following picture.

enter image description here

How can you stop this form happening so as to make the navigation bar stretch across the whole screen.

Thanks

Upvotes: 2

Views: 5540

Answers (2)

KSR
KSR

Reputation: 1709

To fix it,

First remove constraints of the navigation bar and then again assign constraints by unchecking "constrain to margin" checkbox as shown below:

enter image description here

Assign the following four constraints(as shown in above image):

Top space to 0
Leading space to 0
Trailing space to 0
Height fixed to 64

Upvotes: 0

user4388748
user4388748

Reputation:

I had the same problem. I discovered that this is caused by the Navigation Bar's constraints being relative to the view's margin.

In order to fix it in the scene editor, select the constraint, then in the Utilities pane on the right, click on the "First Item" dropdown (should be Navigation Bar.Leading), then uncheck "Relative to margin".

Repeat on the other side.

Hope this helps.

Upvotes: 4

Related Questions