Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Storyboard Safe Area wrong/fixed width for any device

After some rearrangement of the views in a view controller in storyboard, the safe area in that specific view controller became bugged. For any device I select the safe area never update its frame width.

In the gif below, I have the Safe Area selected in the document outline to illustrate that.

enter image description here

When run in a device, the safe area works as expected. So this is an Interface Builder specific problem. Doing a Cmd+Shift+K Clean and deleting Derived Data is not working.

So, is there a known method to rescue that view controller other than recreate it in a new one?

like image 773
nyrd Avatar asked Dec 18 '22 01:12

nyrd


2 Answers

I recently had the same issue. The way I resolved the issue was I selected the "Safe Area" in the storyBoard navigator.

storyBoard navigator

After that I used the restraint controls and choose reset to suggested constraints.

restraint controls

like image 80
Daniel Lyon Avatar answered Dec 27 '22 11:12

Daniel Lyon


This bug happens if a UIStackView contains at least one multi-line UILabel without an explicit preferred width. I have found no easy workaround that succeeds in all cases.

like image 29
phatmann Avatar answered Dec 27 '22 10:12

phatmann