iOS Auto Layout Demystified

 
 
Addison Wesley (Verlag)
  • 1. Auflage
  • |
  • erschienen am 3. April 2013
  • |
  • 240 Seiten
 
E-Book | ePUB mit Adobe-DRM | Systemvoraussetzungen
978-0-13-344067-6 (ISBN)
 
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.
1. Auflage
  • Englisch
  • USA
  • Windows
  • 20,38 MB
978-0-13-344067-6 (9780133440676)
weitere Ausgaben werden ermittelt

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 TUAW.com, 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.

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

DNB DDC Sachgruppen

Dateiformat: ePUB
Kopierschutz: Adobe-DRM (Digital Rights Management)

Systemvoraussetzungen:

Computer (Windows; MacOS X; Linux): Installieren Sie bereits vor dem Download die kostenlose Software Adobe Digital Editions (siehe E-Book Hilfe).

Tablet/Smartphone (Android; iOS): Installieren Sie bereits vor dem Download die kostenlose App Adobe Digital Editions (siehe E-Book Hilfe).

E-Book-Reader: Bookeen, Kobo, Pocketbook, Sony, Tolino u.v.a.m. (nicht Kindle)

Das Dateiformat ePUB ist sehr gut für Romane und Sachbücher geeignet - also für "fließenden" Text ohne komplexes Layout. Bei E-Readern oder Smartphones passt sich der Zeilen- und Seitenumbruch automatisch den kleinen Displays an. Mit Adobe-DRM wird hier ein "harter" Kopierschutz verwendet. Wenn die notwendigen Voraussetzungen nicht vorliegen, können Sie das E-Book leider nicht öffnen. Daher müssen Sie bereits vor dem Download Ihre Lese-Hardware vorbereiten.

Bitte beachten Sie bei der Verwendung der Lese-Software Adobe Digital Editions: wir empfehlen Ihnen unbedingt nach Installation der Lese-Software diese mit Ihrer persönlichen Adobe-ID zu autorisieren!

Weitere Informationen finden Sie in unserer E-Book Hilfe.


Download (sofort verfügbar)

9,99 €
inkl. 7% MwSt.
Download / Einzel-Lizenz
ePUB mit Adobe-DRM
siehe Systemvoraussetzungen
E-Book bestellen