Home > Store > Home & Office Computing > Entertainment/Gaming/Gadgets

iOS Auto Layout Demystified

Register your product to gain access to bonus material or receive a coupon.

iOS Auto Layout Demystified

eBook (Watermarked)

  • Your Price: $19.99
  • List Price: $24.99
  • Includes EPUB, MOBI, and PDF
  • About eBook Formats
  • This eBook includes the following formats, accessible from your Account page after purchase:

    ePub EPUB The open industry format known for its reflowable content and usability on supported mobile devices.

    MOBI MOBI The eBook format compatible with the Amazon Kindle and Amazon Kindle applications.

    Adobe Reader PDF The popular standard, used most often with the free Adobe® Reader® software.

    This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.

Description

  • Copyright 2013
  • Pages: 238
  • Edition: 1st
  • eBook (Watermarked)
  • ISBN-10: 0-13-344065-6
  • ISBN-13: 978-0-13-344065-2

Auto Layout re-imagines the way developers create user interfaces. It provides a flexible and powerful system that describes how views and their content relate to each other and to the windows and superviews they occupy. In contrast to older design approaches, this technology offers incredible control over layout with a wider range of customization than frames, springs, and struts can express.

In this guide, Erica Sadun, bestselling author of The Core iOS 6 Developer's Cookbook and The Advanced iOS 6 Developer's Cookbook, helps readers learn how to use Auto Layout effectively, even masterfully, by providing an abundance of examples alongside plenty of explanations and tips. Instead of struggling with class documentation, you learn in simple steps how the system works and why it’s far more powerful than you first imagined. You read about common design scenarios and discover best practices that make Auto Layout a pleasure rather than a chore to use. Sadun includes examples of non-obvious ways to use Auto Layout to build interactive elements, animations, and other features beyond what you might normally lay out in Interface Builder to help expand the reader’s design possibilities. With this book you will learn

  • The basic concepts that form the foundation of Auto Layout
  • How to create clear and satisfiable rules of your layout, called constraints
  • How to work effectively with the Interface Builder Layout
  • What visual constraints look like, how to work with them, and how they are used in your projects
  • How to debug constraints
  • How to design interfaces when working with Auto Layout
  • Effective solutions to the most common real-world problems and challenges

Approximately 238 pages.

For related content by author Erica Sadun, see The Core iOS 6 Developer’s Cookbook, and The Advanced iOS 6 Developer’s Cookbook.

Sample Content

Online Sample Chapter

Introducing iOS Auto Layout

Sample Pages

Download the sample pages (includes Chapter 1)

Table of Contents

Preface

Chapter 1: Introducing Auto Layout

Saying “No” to Auto Layout

Saying “Yes” to Auto Layout

             Visual Relationships

             Content-Driven Layout

             Prioritizing Rules

             Auto Layout Strengths

Constraints

             Satisfiability

             Sufficiency

Constraint Attributes

Missing Views

             Underconstrained Missing Views

             Missing Views with Inconsistent Rules

             Tracking Missing Views

Ambiguous Layout

             Exercising Ambiguity

             Visualizing Constraints

Intrinsic Content Size

Compression Resistance and Content Hugging

Auto Layout and Frames

             Visualizing Alignment Rectangles

             Image Alignment Insets

             Declaring Alignment Rectangles

             Implementing Alignment Rectangles

Summary

Chapter 2: Constraints

Constraint Types

Priorities

             Conflicting Priorities

             Enumerated Priorities

Content Size Constraints

             Content Hugging

             Compression Resistance

             Setting Content Size Constraints

Layout Constraints

             Constraint Math

The Layout Constraint Class

             First and Second Items

Creating Layout Constraints

Using NSLayoutConstraint

             Unary Constraints

             Zero-Item Constraints

View Items

Constraints, Hierarchies, and Bounds Systems

Installing Constraints

Removing Constraints

Comparing Constraints

             Using Matched Constraints

Laws of Layout Constraints

Summary

Chapter 3: Interface Builder Layout

Constraints in Interface Builder

             What’s What in the IB Editor

             Beginning Constraints

Constraint Listings

             Constraint Colors

             Constraint Icons

             Constraint Listings and Xcode Labels

             Adding Xcode Identities

Selecting Constraints

Inspecting Constraints

             The Constraint Attributes Inspector

View Size Inspector

             Frame and Layout Rectangles

             Constraint Options

Adding User Constraints

             Including Your Own Constraints

             Conflicting Constraints

Building New Constraints

The Missing Views Problem

Balancing Requests

             Balancing Constraint Priorities

Constraints and Outlets

Hybrid Layout

             Building a NIB File for Testing

             Adding the NIB File in Code

             Advantages of Hybrid Layout

Constraints/Resizing Pop-Up Menu

Summary

Chapter 4: Visual Formats

Introducing Visual Format Constraints

Options

             Alignment

             Combining Options

             Skipping Options

Variable Bindings

             The Problem with Indirection

             Indirection Workaround

Metrics

             Real-World Metrics

Format String Structure

Orientation

             Retrieving Constraints by Axis

View Names

             Superviews

Connections

             Empty Connections

             Standard Spacers

             Numeric Spacers

             Referencing the Superview

             Spacing from the Superview

             Flexible Spaces

             Parentheses

             Negative Numbers

             Priorities

             Multiple Views

View Sizes

Format String Components

Getting It Wrong

NSLog and Visual Formats

Constraining to a Superview

View Stretching

Constraining Size

Building Rows or Columns

Matching Sizes

Why You Cannot Distribute Views

             How to Pseudo-Distribute Views (Part 1: Equal Centers)

             Pseudo-Distributing Views (Part 2: Spacer Views)

Summary

Chapter 5: Debugging Constraints

Reading Console Logs

             Example: Autosizing Issues

             Solution: Switch Off Autosizing Translation

             Example: Auto Layout Conflicts

             Solution: Adjusting Priorities

             The Nuclear Approach

             The Balance Approach

             Tracing Ambiguity

Examining Constraint Logs

             Example: Alignment Constraint

             Example: Standard Spacers

             Example: Equation-Based Constraint

             Example: Complex Equation

             Example: The Multiplier and Constant

A Note about Layout Math

Constraint Equation Strings

Adding Names

             Using Nametags

             Naming Views

Describing Views

Example: Unexpected Padding

Example: The Hugged Image

Example: View Centering

             Retrieving Referencing Constraints

Descent Reports

Example: Ambiguity

Example: Expanding on Console Dumps

Visualizing Constraints

             Automating Visualization

Launch Arguments

Internationalization

             Doubled Strings

             Flipped Interfaces (OS X)

             Flipped Interfaces (iOS)

Profiling Cocoa Layout

Auto Layout Rules of Debugging

Summary

Chapter 6: Building with Auto Layout

Basic Principles of Auto Layout

Layout Libraries

Planning Interfaces

Building for Modularity

Updating Constraints

             Calling Updates and Animating Changes

             Animating Constraint Changes on OS X

             Fading Changes

Handling Orientation-Specific Text Layout

Designing for Edge Conditions

Building a View Drawer

             Building the Drawer Layout

             Managing Layout for Dragged Views

             Dragged Views

Window Boundaries

Summary

Chapter 7: Layout Solutions

Table Cells

Preserving Image Aspect

Accordion Sizing

Auto Layout

             Building a Paged Image Scroll View

             Inherent Drawbacks

Centering View Groups

Custom Multipliers and Random Positions

Building Grids

Constraint Animation on Steroids

Summary

Updates

Submit Errata

More Information

Unlimited one-month access with your purchase
Free Safari Membership