Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Constraints and Size Classes in Xcode 8 Beta

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.

like image 461
Tyler Pierog Avatar asked Jul 05 '16 14:07

Tyler Pierog


People also ask

What are constraints in Xcode?

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.

What are the different size classes for iOS?

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).

What is Autolayout What is size classes and how can we use it?

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.

What is size classes in Swift iOS?

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.


1 Answers

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/

like image 126
BrianR Avatar answered Sep 20 '22 23:09

BrianR