Chris Huynh
Chris Huynh

Reputation: 21

Is it possible to have different constraints for different phone sizes in Xcode?

I'm not very experienced with xcode and constraints and I was wondering if it were possible to create different constraints depending on screen size. I'm currently creating a form and ideally, I would want it to look like this:

iPhone 4 vs iPhone 6

Upvotes: 0

Views: 90

Answers (1)

Jonas Zaugg
Jonas Zaugg

Reputation: 3015

Yes, it's very much possible! The best is if you refer to the official Apple documentation : Building for Multiple Screen Sizes

It's a guide about size classes, which you can already see when you click on "w Any, h Any" on the bottom bar of Interface Builder in Xcode. You'll see that you can choose which size class, i.e. which iPhone, the constraints you're currently setting up refer to. Of course, in "w Any, h Any" are the constraints for all sizes and then you'd specify other constraints for others size classes, i.e. phone sizes.

I hope this helps!

Upvotes: 1

Related Questions