I'm trying to create landscape constraints in my app that differ from my portrait constraints. Usually I use size classes in previous versions of Xcode but I am using the beta and all I see are devices.
How do you use this new UI for size classes in Xcode 8? I don't see any documentation about this anywhere.
Cheers.
Most constraints define a relationship between two items in our user interface. These items can represent either views or layout guides. Constraints can also define the relationship between two different attributes of a single item, for example, setting an aspect ratio between an item's height and width.
In iOS, Size Classes are groups of screen sizes that are applied to the width and height of the device screen. The two Size Classes that exist currently are Compact and Regular. The Compact Size Class refers to a constrained space. It is denoted in Xcode as wC (Compact width) and hC (Compact height).
In easy way we can say Autolayout is used for displaying same layout comatible on different different iPhone/iPad screen sizes (ex. Keep button in center for all screen sizes) while through Autoresizing classes we can set a different layout for a particular screen size.
Size classes are traits assigned to user interface elements, like scenes or views. They provide a rough indication of the element's size. Interface Builder lets you customize many of your layout's features based on the current size class. The layout then automatically adapts as the size class changes.
Size classes work very similar to the way they used to. The reason that you now see the devices are because there are so many different traits your device can adapt that change the way the UI works. Not just landscape + portrait, but you have traits for any UI difference possible. This includes things like Interface Style, Dynamic Type, and even the display Gamut.
This WWDC 2016 video will explain it all, and it will give a nice walkthrough of how to design for these new traits in xCode 8.
https://developer.apple.com/videos/play/wwdc2016/222/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With