Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The issue of Interface Builder in Xcode 8

My storyboards are created in Xcode 7. After I installed Xcode 8, all of them are constantly messed up. When I open one of them, Xcode asks me to select a device (which is a nice new feature). But then it never adjusts views' frames, so I must press "All View: Update Frames" infinite amount of times. And even this doesn't fix all "misplaced" views.

Anybody knows how to fight this problem? Or the only option is to pray that Apple fixes it at some point?

UPDATE 1

It happens every time I open IB, even if I've fixed frames previously.

UPDATE 2

When my colleague fixes same storyboards on his computer, changes stay. No idea what makes my Xcode so special.

Example

like image 349
Artem Stepanenko Avatar asked Sep 28 '16 15:09

Artem Stepanenko


2 Answers

I figured out the following workaround

First, set width and height for your view to the values it will calculate on selected device in your storyboard, then preserve superview margins.

This worked for me

enter image description here

like image 161
theDC Avatar answered Nov 02 '22 18:11

theDC


Xcode 8.0 has the bug, that it does not save the rects from the storyboard xml-s. So if you fix misplaced views in Xcode 8.0, the problem is gone for as long as the storyboard stays in RAM. When the storyboard is closed and re-read from a file, the issue appears again. (Actually Xcode 7.0 had exactly the same problem in the beginning.)

Xcode 8.1 beta 3 (the most recent version at the time of this writing) fixes this issue:

  • frames are not 1000x1000, but they stay as they were.
like image 23
thetrutz Avatar answered Nov 02 '22 17:11

thetrutz