Making Apps Adaptive Part 1

https://developer.apple.com/videos/play/wwdc2016/222/?time=511

9min mark

The Specifics of size classes

  • Two classes – horizontalSizeClass, verticalSizeClass
  • Two values – compact and regular
  • Means there are four combinations of traits and values

Screen Shot 2017-05-15 at 1.48.45 PM.png

  • w = width class, h = height class
  • Each one of these can have a value C or R

How does this help me

  • normally you would have to think about 4 combinations
  • But really it’s just two
  • Width is the most common trait you are going to have to interact with

 

How to make specific customizations

  • Demo of size class (21 min)
  • First, note the size of the class you are currently working in (wC hR)
  • This means the customizations you are about to make will apply to this size
  • Screen Shot 2017-05-15 at 2.05.55 PM.png
  • Then in the inspector, any fields with ‘+’ signs means that these are customizable

Screen Shot 2017-05-15 at 2.06.06 PM.png

So if you add a constraint via the ‘+’ sign, like a font, it should override the constraint that applies to all.

How to make work for constraints

So the above works for attributes you add like font and size. But for constraints you need a constraint in place before you can add a modification to it.

So here what you do is click a constraint, hit the ‘+’ sign on the constraint, and then set when it is installed from there. See this.

Advertisements