iOS Auto Layout Demystified [NOOK Book]


Completed Updated for iOS 7 and Xcode 5

Auto Layout transforms the way you create iOS user interfaces. As flexible as it is powerful, Auto Layout gives you unprecedented control over your iOS user interfaces. But Auto Layout has a reputation for difficulty. In iOS Auto Layout Demystified, Second Edition, world-renowned iOS developer and author Erica Sadun strips away the confusion, helping you gain Auto Layout mastery the easiest way possible: ...

See more details below
iOS Auto Layout Demystified

Available on NOOK devices and apps  
  • NOOK Devices
  • Samsung Galaxy Tab 4 NOOK 7.0
  • Samsung Galaxy Tab 4 NOOK 10.1
  • NOOK HD Tablet
  • NOOK HD+ Tablet
  • NOOK eReaders
  • NOOK Color
  • NOOK Tablet
  • Tablet/Phone
  • NOOK for Windows 8 Tablet
  • NOOK for iOS
  • NOOK for Android
  • NOOK Kids for iPad
  • PC/Mac
  • NOOK for Windows 8
  • NOOK for PC
  • NOOK for Mac

Want a NOOK? Explore Now

NOOK Book (eBook)
$19.19 price
(Save 20%)$23.99 List Price


Completed Updated for iOS 7 and Xcode 5

Auto Layout transforms the way you create iOS user interfaces. As flexible as it is powerful, Auto Layout gives you unprecedented control over your iOS user interfaces. But Auto Layout has a reputation for difficulty. In iOS Auto Layout Demystified, Second Edition, world-renowned iOS developer and author Erica Sadun strips away the confusion, helping you gain Auto Layout mastery the easiest way possible: by example.

Fully updated for iOS 7 and Xcode 5, this tutorial delivers everything Sadun’s guides are famous for: clear explanations, expert tips, proven best practices--and, above all, plenty of code to learn from and reuse.

Step by step, Sadun explains how Auto Layout “thinks,” how it works, where it fits, and why it’s more useful (and simpler) than you ever imagined. She offers practical solutions for a wide variety of real-world iOS development challenges, plus innovative ways to use Auto Layout to build interactive elements, animations, and more.

If you’re an experienced iOS developer, this guide will expand your design possibilities, helping you build apps that are superbly usable and intuitive and stand out even in the most crowded marketplace.

Coverage includes

  • Mastering Auto Layout’s basic concepts, techniques, and approach
  • Defining unambiguous, satisfiable constraints that express your layout exactly how you intend
  • Overcoming obstacles to constraint-based user interface design in Interface Builder
  • Using visual formatting to express how items are laid out vertically and horizontally
  • Making visual formats more flexible with metrics dictionaries and layout options
  • Debugging constraints and deciphering those bewildering Xcode log messages
  • Using descriptive techniques to uncover and express natural relationships in your design
  • Applying iOS Auto Layout techniques in Mac OS X apps too
Read More Show Less

Product Details

  • ISBN-13: 9780133750782
  • Publisher: Pearson Education
  • Publication date: 11/11/2013
  • Series: Mobile Programming
  • Sold by: Barnes & Noble
  • Format: eBook
  • Edition number: 2
  • Pages: 288
  • Sales rank: 1,407,706
  • File size: 23 MB
  • Note: This product may take a few minutes to download.

Meet the Author

Erica Sadun is the bestselling author, coauthor, and contributor to several dozen books on programming, digital video and photography, and web design, including the widely popular The Core iOS 6 Developer's Cookbook, Fourth Edition. She currently blogs at and has blogged in the past at O'Reilly's Mac Devcenter, Lifehacker, and Ars Technica. In addition to being the author of dozens of iOS-native applications, Erica holds a Ph.D. in computer science from Georgia Tech's Graphics, Visualization, and Usability Center. A geek, a programmer, and an author, she's never met a gadget she didn't love. When not writing, she and her geek husband parent three geeks-in-training, who regard their parents with restrained bemusement when they're not busy rewiring the house or plotting global domination.

Read More Show Less

Table of Contents


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




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


Chapter 2: Constraints

Constraint Types


             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


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


Chapter 4: Visual Formats

Introducing Visual Format Constraints



             Combining Options

             Skipping Options

Variable Bindings

             The Problem with Indirection

             Indirection Workaround


             Real-World Metrics

Format String Structure


             Retrieving Constraints by Axis

View Names



             Empty Connections

             Standard Spacers

             Numeric Spacers

             Referencing the Superview

             Spacing from the Superview

             Flexible Spaces


             Negative Numbers


             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)


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


             Doubled Strings

             Flipped Interfaces (OS X)

             Flipped Interfaces (iOS)

Profiling Cocoa Layout

Auto Layout Rules of Debugging


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


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


Read More Show Less

Customer Reviews

Average Rating 5
( 1 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Terms of Use.
  • - Barnes & reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing 1 Customer Reviews
  • Anonymous

    Posted August 20, 2014

    Shooting Range/ Target Practice

    Learn how to shoot a gun or enhance your kills here. No Killing.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing 1 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)