KirillC
KirillC

Reputation: 800

Storyboard preview issue after converting to Swift 3/Xcode 8

Something strange happened to my project after I upgraded to Xcode 8 and converted the project to Swift 3. Most interesting thing is that layout shows fine in the simulator but in the Preview everything is shifted to the right. Center of all devices appears to be almost at the right edge. For example I drag a label to the storyboard select Align Horizontally and add a constraint to the top... in preview it shows up for all devices shifted to the right instead of in the middle but in the simulator label is in the middle, exactly where it is supposed to be. Also, if I create a new ViewController is would work just fine in preview and simulator... Anybody knows what can cause this issue?

Upvotes: 1

Views: 880

Answers (2)

Uwe
Uwe

Reputation: 65

Leaving Xcode and re-starting worked for me to get the correct view per device in Storyboard again.

Upvotes: 0

Rob
Rob

Reputation: 438232

In Interface Builder, select the view controller and then choose "Update Frames" from the "Resolve Auto-Layout Issues" popover menu that is in the lower right corner of the Interface Builder canvas. The issue is that in Xcode 8, the size of the previewed scenes has changed. If you tell it to "Update Frames", the various subviews should be adjusted to reflect the new "simulated size" for the scene's top level view (assuming all of your constraints are properly defined).

enter image description here

Upvotes: 2

Related Questions