Siriss
Siriss

Reputation: 3777

Xcode 6 - Using Size Classes with iPhone 4/5

So I have seen a few posts coming out about this, but I am having a ridiculous time withe the Class Sizes in the new storyboard. Following the guides from apple and online, I can't get the sizing to work with the 3.5 or 4 inch screens without compressing everything on the larger screens.

Here is my Any/Any

enter image description here

And here is what I get:

enter image description here

I have tried a ton of different constraints and I can't get it to work. Mainly, I want to be able to keep the proportional spacing with the different screen sizes.

What constraints am I missing? (they are all blue now)

Is there a good guide out there for this yet?

EDIT: How do you get the layout to work for the 3.5 and 4 inch screens without compressing everything on the larger screens also? What constraints or Size Class settings do you need?

Upvotes: 2

Views: 1566

Answers (1)

Aaron Brager
Aaron Brager

Reputation: 66302

Your top view should have these constraints:

  • Top Space to Top Layout Guide = 20 (or whatever)
  • Two horizontal constraints; for example:
    • Align Center X to Superview
    • Width = 300

When viewing the Any/Any view, click on the top text field, and select All under Constraints. Make sure there are no other constraints that might be different when the view is constrained.

Here's a screenshot of what your constraint setup should look like:

enter image description here

Here's a screenshot of it working great on a 3.5" iPhone:

enter image description here

Upvotes: 1

Related Questions