KDeogharkar
KDeogharkar

Reputation: 10959

Trailing space issue for Autolayout

I am new in auto layout feature for iOS. I found very good tutorial for this here

Now I am practicing by myself and I create one simple registration form using autolayout like this:

view->scrollview->all controls

enter image description here

As you can see parent for all control is scroll view now I am maintaining trailing space to superview(here Scrollview) of textview to 20 and I also remove the fix length for all the text view so in landscape mode textview width will increase automatically by maintaining the trailing space but the result is like below image (landscape view):

enter image description here

As you can see the trailing space is not maintain. If I set all the control directly in view and remove scroll view than it is working perfectly well. Am I missing something?

Upvotes: 0

Views: 332

Answers (1)

βhargavḯ
βhargavḯ

Reputation: 9836

Trailing and Leading space of "Registration" label is causing issue in your case.

So in order to get rid of this situation follow these steps.

  1. Give Center Alignment to Registration Label from xib.
  2. Give full width to Registration Label. This will cause Trailing and Leading space to match with superview.
  3. Run your app and check layouts. :)

Upvotes: 1

Related Questions