Dan Levy
Dan Levy

Reputation: 4281

Xcode 7 to Xcode 8 Storyboard Constraint Warnings

I just converted my Xcode project from Xcode 7.3 to Xcode 8 GM and I am getting over 80 constraint warnings. In Xcode 7, my storyboards were "big squares" rather than a specific iPhone size. Now, with Xcode 8, you can change to the different iPhone and iPad sizes. My constraints are still showing up as they were with the more squared-off VCs in Xcode 7. Is there a "quick" fix or do I need to go through my entire app and fix each and every constraint (far more than 80)?

UPDATE: September 20,2016 -> Many bug reports have been filed based on this feed and Apple should be aware of the problem. I will update with an answer as soon as the problem is fixed.

Upvotes: 25

Views: 3439

Answers (3)

Francesco
Francesco

Reputation: 229

Select the view controllers one by one and press "Update Frames" each time.

Upvotes: 0

Xiang LI
Xiang LI

Reputation: 345

Select all the Scenes(View Controllers) in the Storyboard, show the Size inspector, change the Simulated Size to Freeform, then set Width Height = 600.

Then, those tons of warnings disappear.

enter image description here

Upvotes: 14

Rogoon
Rogoon

Reputation: 91

I had the same issue when updating to Xcode 8. My storyboard looked just like you describe. Check your warnings/errors. If they all say something like "set vertical hugging priority to X" or "set compression resistance to Y" then you should be able to fix your issue by setting the priorities as suggested.

Click a warning, then in the attribute inspector under the tab with the ruler icon (not sure what that tab is called) you can set the priorities under the Content Hugging Priority and Content Compression Resistance Priority headers. As you update these properties the warnings should start to change to incorrect frame warnings, at which point you can just update the frames.

This might not be a quick fix, but changing a few priorities for some constraints is easier than redoing all the constraints. I hope this helps!

Upvotes: 1

Related Questions