Tony Friz
Tony Friz

Reputation: 893

Auto layout is ignoring the trailing space constraint only on one particular view, or so it seems

I'm trying to get some subviews inside of a view inside of a scroll view to extend the width of the view minus 16px margin on either side. I have no width constraint set, only height constraint, vertical spacing constraint, and leading/trailing spacing constraint. This exactly same procedure worked on a different view but in this new view auto layout is not maintaining 16px spacing for the trailing space constraint. Below is a screenshot of what is happening:

enter image description here

As you can see, even though there's a 16px trailing constraint, when I update frames and/or run the app, the register button just snaps all the way back to a 194.5px trailing space. I don't believe I have a relative margin set but I'm not certain.

Any help is greatly appreciated.

Upvotes: 0

Views: 315

Answers (1)

oren
oren

Reputation: 3199

Your image states that you have some sort of misplaced view. The orange line states that this isn't what will actually be rendered, but the (+194.5) one. Please try to do the following steps and see if it helps.

Before: Before

The misplaced view:

enter image description here enter image description here

After I update frame:

enter image description here

Did you try to do these steps? If it doesn't help, post an image after you click 'update fames' Thanks

Upvotes: 0

Related Questions