Interface Builder changes x, y, width and height values randomly.

I have old projects without autolayout. When I open the storyboard in Interface Builder everything looks fine. But if I move a button or label by one pixel, for example, or add a new UIView, then the Interface Builder randomly changes the x, y, width, or height values for almost all elements in all UIViewControllers in the storyboard file. Not all values are changed, but a lot. If I close and open Storyboard a few times and do an action, the values are changed so many times that the user interface is completely broken.

Does anyone have an idea how I can fix the problem? I am using Xcode 14.0.1 and it happens with all projects I have.

The changes look like this, for example:

Answered by vsmedia in 734384022

Yesterday I updated the operating system of my MacBook to macOS Ventura 13.0 and the problem described above in the Xcode Interface Builder is gone. It works perfectly again on the new operating system. Now only those values are changed that I actually change myself.

Accepted Answer

Yesterday I updated the operating system of my MacBook to macOS Ventura 13.0 and the problem described above in the Xcode Interface Builder is gone. It works perfectly again on the new operating system. Now only those values are changed that I actually change myself.

Installing the new operating system was not the reason why it suddenly worked properly. The solution was to set the zoom in Interface Builder to 100% before changing anything on the storyboard.

I can confirm the bug is still there in Xcode 14.2 RC.

I did the test:

  • set zoom at 75% for storyboard
  • add a UIView in a VC
  • close storyboard and reopen

No issue

  • Close the project
  • reopen project

No issue either

I'm experiencing this same issue in Xcode 14.1. UI elements are randomly shifting by origin and size by a couple pixels. Not all items, but a lot. Zooming to 100% didn't make a difference.

I still have this problem. Unfortunately I haven't found a solution. In all projects, values are changed randomly from the Interface Builder when I change something in the storyboard. I still do not know why.

I thought it might be the resolution of the connected monitor, because of the scaling. But it also happens with the MacBook only, without a second monitor connected.

After I change something in the storyboard, I always have to manually synchronize the files with a text comparison program to undo the unwanted changes. I could of course program the whole design in source code. Unfortunately, that is a lot of work. The apps have been working for years with the design in Interface Builder and only small adjustments are made in the source code when the device is rotated, for example. I don't want to move everything to the source code now.

It would be nice to find the cause and fix it so everything can be done reliably in Interface Builder again.

Unfortunately, I marked this topic as solved too early. The accepted answer isn't the solution to the problem, but I can't change that now.

I also tried setting NSHighResolutionCapable to false in the Info.plist for Xcode. Xcode then starts in the simple resolution, but the values are still randomly changed by the Interface Builder when I change something in the storyboard.

This is nuts, it even changes small x,y width and height values when you just open the storyboard, do nothing and save it.

Tried XCode 14.3 beta, in the changelog Apple claims that it is fixed. Tested it today. It is not fixed.

Our workaround is to do all storyboard work with XCode 13.4.1. There are no problems with that version. Of course, it's not a long-term solution.

Interface Builder changes x, y, width and height values randomly.
 
 
Q