Join Scott Gardner for an in-depth discussion in this video Anatomy of a constraint, part of iOS UI Development with Visual Tools.
- View Offline
- Constraints can, and often are,…between two views, as I'll show in a moment,…but they can also be self-contained,…such as to specify an explicit width or height.…For example, I previously created…a width constraint equal to 240 points.…Let me break that down.…The anatomy of an explicit width or height constraint…starts with the view to which the constraint applies,…followed by an indication…whether it's a width or height constraint.…Next, its width or height value…is set to be equal to some constant value.…I created an equal relation in Xcode previously.…
However, you can also specify inequality relations,…such as greater than or equal to…or less than or equal to.…This is common when used with multiple constraints…to allow views to be dynamically sized…relative to other views.…I'll get into that a little later.…I set the width to be an explicit value of 240 points.…This is called a constant, but, ironically,…it isn't a constant.…It is common practice to change constant values…at runtime to resize or move views.…
Here iOS app architect Scott Gardner explains how to create designable views and dynamic and adaptive user interfaces for any screen size or orientation. He shows how to work with stack views, images, custom fonts, and Interface Builder's Auto Layout tools, which speed up your design process and help adhere to Apple's interface guidelines. Along the way, he provides best practices for designing interfaces that are clean, efficient, and enjoyable for users.
- Creating and customizing views
- Laying out a user interface
- Working with dynamic Auto Layout designs
- Stacking views
- Creating an adaptive layout
- Handling orientation changes
- Working with images
- Customizing fonts