Heena
Heena

Reputation: 2358

Why all already set auto layout constrains are gone if change the frame of view?

enter image description here

As shown in screen shot I made all 4 views' widths equally and height equally after that if i change the frame size of green view all the other constraints as Horizontal spacing,vertical spacing are gone and I have to start from the beginning for all view to work in both portrait and landscape.

Also after that i Set All constrains again and still in landscape mode labels are not showing properly as shown in screen shotenter image description here

I set these constrains.enter image description here

Is there something I am missing?

Upvotes: 0

Views: 369

Answers (2)

Sandeep Ankam
Sandeep Ankam

Reputation: 316

The reason why the constraints which were already were removed is because the constraints were not satisfied. The system intelligently adjusts the constraints if it find the constraints were not satisfied. Refer to previous answer and make sure the autoLayoutTrace has no violations.

Upvotes: 0

Sandeep Ankam
Sandeep Ankam

Reputation: 316

Look at the log for more information to make sure your constraints are breaking or not.

Follow these steps to see if you have Unsatisfiable / Ambiguous Constraints

1) Run the app and then pause it.

2) Type/send the following message to UIWindow in lldb debugger.

           po [UIWindow keyWindow] _autoLayoutTrace]

3) This gives you the auto-layout trace and you can easily figure out what's going wrong.

Upvotes: 1

Related Questions