10

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

Artem Stepanenko
  • 3,423
  • 6
  • 29
  • 51
  • Did you manage to fix the issue? – Berker Soyluoglu Oct 07 '16 at 06:39
  • Well, it's definitely an Apple's bug. So it couldn't be fixed in a normal way. My colleague fixed all misplaced views on his machine and pushed it to git. Since then misplaced views appear rarely, and only some of them (not all as before). Yes, it's dumb, but I haven't found a better solution so far. – Artem Stepanenko Oct 07 '16 at 10:55
  • Thank you so much for your quick response. I hope Apple fixes this issue as soon as possible. – Berker Soyluoglu Oct 07 '16 at 12:24
  • I have backup, So, I just open my backup in Xcode 7.3 open Storyboard as Source code copy and paste it in my latest code. That's It. It work for me. – Mihir Oza Apr 24 '17 at 12:20

2 Answers2

2

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

theDC
  • 6,364
  • 10
  • 56
  • 98
  • Thanks for the answer, but, unfortunately, I don't see how can it help. – Artem Stepanenko Sep 29 '16 at 11:26
  • Please correct me if I'm wrong. You suggest to update frames for every single view on the storyboard and set them the "Preserve..." flag? And what if I select a different device later? – Artem Stepanenko Sep 29 '16 at 11:40
  • In my case it occured only in one ViewController in storyboard, all of the others were fine. After doing the aforementioned edits I manage to get rid of this error. However, this is ceriantly a Xcode bug and must be fixed in the next release – theDC Sep 29 '16 at 11:41
  • I see. Thanks @DCDC. Unfortunately, for me it would be a crazy amount of changes. – Artem Stepanenko Sep 29 '16 at 11:45
  • I too had this issue. it seems Apple got rid of the orientation option. I had my scenes designed in landscape mode. Apple defaults to portrait. So, I had layout issues. Updating the frames was the fix for me. As of Xcode 8.1 B3. This has not been fixed by Apple as yet. @ArtemStepanenko have you filed a radar with Apple? – Robert J. Clegg Oct 18 '16 at 14:52
  • Hm, actually *Xcode 8.1 beta 3* works pretty well for me. – Artem Stepanenko Oct 19 '16 at 15:33
1

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.
Artem Stepanenko
  • 3,423
  • 6
  • 29
  • 51
thetrutz
  • 1,395
  • 13
  • 12