This book teaches you Auto Layout, Apple’s elegant solution to making your user interfaces flexible and adaptable.
This book will be your guide as you explore and master the many capabilities of Auto Layout.
This book is for iOS developers of all skill levels, from those just getting started building user interfaces to the experienced hands who want to get more from Auto Layout.
After completing this book, you’ll be prepared to harness the full power of Auto Layout in all of your apps.
Start your journey into Auto Layout with the foundations you need.
Get an overview of Auto Layout and how to start “thinking in Auto Layout”. Learn what constraints are and the formula that defines them. Meet other key concepts such as intrinsic content size and priorities.
Learn to use Xcode’s visual tool, Interface Builder, to construct a user interface complete with all Auto Layout constraints. See how to preview your interface on multiple device sizes and orientations. Then, learn to create .xib files to describe a smaller — and potentially reusable — subset of a UI.
Learn about UIStackView, an intelligent view container that makes many layout decisions for you. Build a complex layout using nested stack views. See how using stack views can eliminate the need for you to manually construct Auto Layout constraints.
Build on what you learned in Section I to begin using Auto Layout in more complex ways.
Learn how to build your user interface without using Interface Builder. Explore the Visual Format Language (VFL), which you can use to describe a set of constraints. Learn to refactor UIs built with Interface Builder into code.
Use scroll views to create user interfaces that go beyond the size of a physical screen. Learn about the special challenges they present when using Auto Layout and discover how to configure them.
Learn how to configure views that change size to account for dynamic content. See how to use Auto Layout to configure dynamically-sized cells in table views and collection views.
Explore using Layout Guides to create space in your layout without using empty views. Learn about the system-provided guides and how to create your own custom guides.
Discover what happens when the Auto Layout engine must choose between conflicting constraints. Learn how to use priorities to communicate how the system should resolve ambiguities to create the layout you want.
Learn to animate constraints to create unique and engaging user experiences in your apps. See how animation can provide feedback, focus user attention and improve navigation.
See Auto Layout’s real power come to life as you learn how to build adaptive user interfaces that adjust to screen size and orientation. Learn about traits such as layout direction, dynamic type size and size classes. Discover how trait collections allow you to build an adaptive layout without writing device-specific code.
Learn to make your app more accessible by supporting Dynamic Type. Understand how Auto Layout and Dynamic Type interact so you can manage layout changes in your app based on user type size preferences.
Learn how Auto Layout can assist you in internationalizing your app. See how to test if your app is ready for localization. Discover the things you must consider when creating your constraints to allow your app to handle other languages seamlessly.
Learn how to investigate when Auto Layout doesn’t give you the desired result. See how to read Auto Layout’s log messages and how to use other Xcode tools, such as symbolic breakpoints and the view debugger, to resolve Auto Layout conflicts.
Deepen your knowledge of Auto Layout by exploring these more advanced topics.
Pull back the curtain and see the inner workings of Auto Layout. Explore the math behind the magic and discover the “why” behind the behavior of the Auto Layout engine.
Learn to fine-tune your app’s Auto Layout performance. Learn about best practices and about common mistakes that cost you performance.
Learn to use Xcode playgrounds to prototype your user interfaces. See how this technique can streamline your development process and make you more efficient.
Learn how to support external displays in your app. Learn to build a layout for external display, how to handle display connect and disconnect events, and how to accommodate different external display resolutions.
Learn techniques for creating custom user interface controls that work well with Auto Layout. Integrate many of the things you’ve learned in this book to create control animations, adjust to size classes and more.