Mysteries of Auto Layout, Part 1

Similar documents
Implementing UI Designs in Interface Builder

New UIKit Support for International User Interfaces

Building Watch Apps #WWDC15. Featured. Session 108. Neil Desai watchos Engineer

Cocoa Touch Best Practices

ios Accessibility Developing for everyone Session 201 Ian Fisch ios Accessibility

Mastering UIKit on tvos

Designing for Apple Watch

Enhancing your apps for the next dimension of touch

Using and Extending the Xcode Source Editor

Monetize and Promote Your App with iad

What s New in Xcode App Signing

What's New in UIKit Dynamics and Visual Effects Session 229

What s New in NSCollectionView Session 225

Data Delivery with Drag and Drop

High Performance Auto Layout

Building Apps with Dynamic Type

Adopting Advanced Features of the New UI

What s New in MapKit. App Frameworks #WWDC17. Fredrik Olsson

Accessibility on ios. Developing for everyone. Frameworks #WWDC14. Session 210 Clare Kasemset ios Accessibility

Introducing On Demand Resources

Advanced Scrollviews and Touch Handling Techniques

ios DeCal : Lecture 2 Structure of ios Applications: MVC and Auto Layout

Seamless Linking to Your App

What s New in Notifications

Accessibility on OS X

What s New in imessage Apps

TL;DR: Interface builder is the tool within Xcode for creating a User Interface via a GUI.

What s New in tvos #WWDC16. App Frameworks. Session 206. Hans Kim tvos Engineer

Introducing the Contacts Framework

AUTO LAYOUT IS A UNICORN

Leveraging Touch Input on ios

Improving your Existing Apps with Swift

Touch Bar Fundamentals

Media and Gaming Accessibility

Extending Your Apps with SiriKit

Modern Auto Layout. Building Adaptive Layouts For ios. Keith Harrison. Web: useyourloaf.com Version: 1.0 ( ) Copyright 2018 Keith Harrison

Localization Best Practices on tvos

Mastering Drag and Drop

imessage Apps and Stickers, Part 2

Profiling in Depth. Do you know where your code is? Session 412. Kris Markel Performance Tools Engineer Chad Woolf Performance Tools Engineer

Creating Complications with ClockKit Session 209

Apple Watch Design Tips and Tricks

What s New in CloudKit

WatchKit In-Depth, Part 2

App Extension Best Practices

Advanced Debugging and the Address Sanitizer

View Controller Advancements for ios8

Designing Great Apple Watch Experiences

Introducing Password AutoFill for Apps

What s New in Metal, Part 2

Getting the Most Out of HealthKit

Internationalization Best Practices

Modern User Interaction on ios

Introducing the Modern WebKit API

Building Visually Rich User Experiences

Power, Performance, and Diagnostics

Advances in TVMLKit. App Frameworks #WWDC17. Trevor Cortez, Localization Engineer Parry Panesar, tvos Engineer Jeremy Foo, tvos Engineer

Storyboards and Controllers on OS X

Cross Platform Nearby Networking

Thread Sanitizer and Static Analysis

What s New in SpriteKit

Introducing Swift Playgrounds

What s New in tvos 12

Mastering Xcode for iphone OS Development Part 1. Todd Fernandez Sr. Manager, IDEs

Optimizing Swift Performance Session 409

Creating Content with iad JS

Localizing with Xcode 9

Creating Great App Previews

Networking with NSURLSession

What s New in Core Image

Core ML in Depth. System Frameworks #WWDC17. Krishna Sridhar, Core ML Zach Nation, Core ML

Introducing the Photos Frameworks

Swift API Design Guidelines

Working with Metal Overview

Adapting to the New UI of OS X Yosemite

Quick Interaction Techniques for watchos

What s New in LLDB. Debug your way to fame and glory #WWDC15. Developer Tools. Session 402

Advances in AVFoundation Playback

CSC 581: Mobile App Development Spring 2018

What s New in watchos

Advanced Cocoa Text Tips and Tricks. Aki Inoue Cocoa Engineer

CloudKit Tips And Tricks

ITP 342 Mobile App Dev. Animation

Localizing with Xcode 6

Mastering Xcode for iphone OS Development Part 2. Marc Verstaen Sr. Manager, iphone Tools

Using Grouped Notifications

Getting Published in Apple News

Understanding Undefined Behavior

Getting the Most out of Playgrounds in Xcode

In the first class, you'll learn how to create a simple single-view app, following a 3-step process:

Introduction to Siri Shortcuts

Finding Bugs Using Xcode Runtime Tools

Introducing SiriKit. Hey Siri, say hello to apps #WWDC16. App Frameworks. Session 217

What s New in Cocoa for macos

ios 9 Day by Day Also by shinobicontrols This version was published Scott Logic Ltd

Advanced Notifications

Improving the Accessibility and Usability of Complex Web Applications

Mobile Application Programming. Layout Techniques

What s New in Core Data?

Editing Media with AV Foundation

Transcription:

App Frameworks #WWDC15 Mysteries of Auto Layout, Part 1 Session 218 Jason Yao Interface Builder Engineer Kasia Wawer ios Keyboards Engineer 2015 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from Apple.

Auto Layout

Auto Layout

Getting Started with Auto Layout? See previous WWDC sessions on http://developer.apple.com/videos/

Outline Part 1 Morning Maintainable Layouts Changing Constraints View Sizing Self-Sizing Table View Cells Priorities Alignment Part 2 Afternoon The Layout Cycle Legacy Layout Constraint Creation Constraining Negative Space Unsatisfiable Constraints Resolving Ambiguity

Outline Part 1 Morning Maintainable Layouts Changing Constraints View Sizing Self-Sizing Table View Cells Priorities Alignment Part 2 Afternoon The Layout Cycle Legacy Layout Constraint Creation Constraining Negative Space Unsatisfiable Constraints Resolving Ambiguity

Maintainable Layouts Mystery #1

Constraints Spacing and alignment Mysteries of Auto Layout

Constraints Spacing and alignment Mysteries of Auto Layout Mysteries of Auto Layout

Many Constraints

Stack View UIStackView (ios 9) and NSStackView (OS X 10.9) stackstacktest Build stackstacktest: Succeeded Today at 3:05

Stack View

Stack View Built with Auto Layout

Stack View Built with Auto Layout Manages constraints

Stack View Built with Auto Layout Manages constraints Horizontal or vertical

Stack View Alignment

Stack View Alignment

Stack View Distribution

Demo Stack View in Interface Builder

Animate // ios 9 UIView.animateWithDuration(1.0) { () -> Void in self.subviewtohide.hidden =!self.subviewtohide.hidden }

Animate // ios 9 UIView.animateWithDuration(1.0) { () -> Void in self.subviewtohide.hidden =!self.subviewtohide.hidden }

Animate // ios 9 UIView.animateWithDuration(1.0) { self.subviewtohide.hidden =!self.subviewtohide.hidden } // OS X 10.11 NSAnimationContext.runAnimationGroup({ context in context.duration = 1.0 self.subviewtohide.animator().hidden =!self.subviewtohide.hidden }, completionhandler: nil)

API // ios 9 class UIStackView { var axis:uilayoutconstraintaxis var distribution:uistackviewdistribution var alignment:uistackviewalignment var spacing:cgfloat func addarrangedsubview(view: UIView) var arrangedsubviews:[uiview] } // OS X 10.11 class NSStackView { var orientation:nsuserinterfaceorientation var distribution:nsstackviewdistribution var alignment:nslayoutattribute var spacing:cgfloat func addarrangedsubview(view: NSView) var arrangedsubviews:[nsview] }

API // ios 9 class UIStackView { var axis:uilayoutconstraintaxis var distribution:uistackviewdistribution var alignment:uistackviewalignment var spacing:cgfloat func addarrangedsubview(view: UIView) var arrangedsubviews:[uiview] } // OS X 10.11 class NSStackView { var orientation:nsuserinterfaceorientation var distribution:nsstackviewdistribution var alignment:nslayoutattribute var spacing:cgfloat func addarrangedsubview(view: NSView) var arrangedsubviews:[nsview] }

Stack View in Interface Builder

Stack View in Interface Builder Easy to build

Stack View in Interface Builder Easy to build Easy to maintain

Stack View in Interface Builder Easy to build Easy to maintain Composable Stack Views

Stack View in Interface Builder Easy to build Easy to maintain Composable Stack Views Lightweight

Before and After Before, many constraints

Before and After After, four constraints with Stack View

Start with Stack View, use constraints as needed

Feeding the Layout Engine Mysteries of Auto Layout, part 1 Kasia Wawer ios Keyboards Engineer

Getting from Constraints to Layout Views Constraints in IB Constraints in VFL Explicit constraints

Getting from Constraints to Layout Views Constraints in IB??? Constraints in VFL Explicit constraints

Getting from Constraints to Layout Views Constraints in IB Constraints in VFL??? Your Layout Explicit constraints

Getting from Constraints to Layout Views Constraints in IB Constraints in VFL??? Your Layout? Explicit constraints

Getting from Constraints to Layout???

Getting from Constraints to Layout???

Changing Constraints Mystery #2

Activate and Deactivate

Activate and Deactivate Constraints find their own container

Activate and Deactivate Constraints find their own container Adds constraints efficiently

Activate and Deactivate Constraints find their own container Adds constraints efficiently Do not need to own all views

Activate and Deactivate

Activate and Deactivate Add and remove

Activate and Deactivate Activate and deactivate

Things to Keep in Mind

Things to Keep in Mind Never deactivate self.view.constraints

Things to Keep in Mind Never deactivate self.view.constraints Not all of those constraints belong to you

Things to Keep in Mind Never deactivate self.view.constraints Not all of those constraints belong to you Weird things will happen

Things to Keep in Mind Never deactivate self.view.constraints Not all of those constraints belong to you Weird things will happen Just don t do it!

Things to Keep in Mind Never deactivate self.view.constraints Not all of those constraints belong to you Weird things will happen Just don t do it! Keep references to constraints that change

Demo Changing constraints

Changing Constraints

Changing Constraints Never deactivate self.view.constraints

Changing Constraints Never deactivate self.view.constraints Keep references to constraints

Changing Constraints Never deactivate self.view.constraints Keep references to constraints Animate changing constraints with view animation

Building the Layout Views Constraints in IB Constraints in VFL Layout Engine Explicit constraints

View Sizing Mystery #3

View Size Intrinsic content size Content size Label text Content size

View Size Intrinsic content size Certain views have an intrinsiccontentsize For instance labels and image views Content size Label text Content size

View Size Intrinsic content size Certain views have an intrinsiccontentsize For instance labels and image views Size derived from non-constraint internals Content size Label text Content size

View Size Intrinsic content size Certain views have an intrinsiccontentsize For instance labels and image views Size derived from non-constraint internals Content size Label text System makes the size constraints Content size

View Size Intrinsic content size Certain views have an intrinsiccontentsize For instance labels and image views Size derived from non-constraint internals Content size Label text System makes the size constraints Layout size is not guaranteed Content size

View Size Defining a particular view size

View Size Defining a particular view size Use constraints first

View Size Defining a particular view size Use constraints first Override intrinsiccontentsize for specific reasons

View Size Defining a particular view size Use constraints first Override intrinsiccontentsize for specific reasons If size information does not come from constraints

View Size Defining a particular view size Use constraints first Override intrinsiccontentsize for specific reasons If size information does not come from constraints If view has custom drawing (sometimes)

View Size Defining a particular view size Use constraints first Override intrinsiccontentsize for specific reasons If size information does not come from constraints If view has custom drawing (sometimes) You will be responsible for invalidating

View Size Defining a particular view size Use constraints first Override intrinsiccontentsize for specific reasons If size information does not come from constraints If view has custom drawing (sometimes) You will be responsible for invalidating Size can change with size class changes

Example

Example widthconstraint = NSLayoutConstraint(item: imageview, attribute:.width, relatedby:.equal, toitem: self.view, attribute:.width, multiplier: 0.75, constant: 0.0) Width Proportion

Example widthconstraint = NSLayoutConstraint(item: imageview, attribute:.width, relatedby:.equal, toitem: self.view, attribute:.width, multiplier: 0.75, constant: 0.0) Width Proportion

Example widthconstraint = NSLayoutConstraint(item: imageview, attribute:.width, relatedby:.equal, toitem: self.view, attribute:.width, multiplier: 0.75, constant: 0.0) Height Proportion heightconstraint = NSLayoutConstraint(item: imageview, attribute:.height, relatedby:.equal, toitem: imageview, attribute:.width, multiplier: 1.5, constant: 0.0)

Example widthconstraint = NSLayoutConstraint(item: imageview, attribute:.width, relatedby:.equal, toitem: self.view, attribute:.width, multiplier: 0.75, constant: 0.0) Height Proportion heightconstraint = NSLayoutConstraint(item: imageview, attribute:.height, relatedby:.equal, toitem: imageview, attribute:.width, multiplier: 1.5, constant: 0.0)

Self-Sizing Table View Cells Mystery #4

Self-Sizing Table View Cells

Self-Sizing Table View Cells Self-sizing needs size from constraints

Self-Sizing Table View Cells Self-sizing needs size from constraints Width is defined with table view cells

Self-Sizing Table View Cells Self-sizing needs size from constraints Width is defined with table view cells Constraints must determine height

Self-Sizing Table View Cells Self-sizing needs size from constraints Width is defined with table view cells Constraints must determine height Take advantage of proportions

Self-Sizing Table View Cells Self-sizing needs size from constraints Width is defined with table view cells Constraints must determine height Take advantage of proportions

Self-Sizing Table View Cells Self-sizing needs size from constraints Width is defined with table view cells Constraints must determine height Take advantage of proportions

Self-Sizing Table View Cells Self-sizing needs size from constraints Width is defined with table view cells Constraints must determine height Take advantage of proportions

Demo Self-sizing Table View Cells

View Sizing

View Sizing Certain views have an intrinsiccontentsize

View Sizing Certain views have an intrinsiccontentsize Constraints should define size when possible

View Sizing Certain views have an intrinsiccontentsize Constraints should define size when possible For self-sizing views, define size fully in constraints

Building the Layout Views Constraints in IB Constraints in VFL Layout Engine Explicit constraints

Building the Layout Sizing constraints Views Constraints in IB Constraints in VFL Layout Engine Explicit constraints

Building the Layout Sizing constraints Views Constraints in IB Constraints in VFL Layout Engine Explicit constraints intrinsiccontentsize

Priorities Mystery #5

Ambiguity Why does it happen?

Ambiguity Why does it happen? More than one layout solution

Ambiguity Why does it happen? More than one layout solution Not enough constraints

Ambiguity Why does it happen? More than one layout solution Not enough constraints

Ambiguity Why does it happen? More than one layout solution Not enough constraints

Ambiguity Why does it happen? More than one layout solution Not enough constraints Equal, non-required priorities

Ambiguity Why does it happen? More than one layout solution Not enough constraints Equal, non-required priorities The engine makes a choice

Constraint Priorities

Constraint Priorities Priorities go from 1 1000

Constraint Priorities Priorities go from 1 1000 Required is 1000 DefaultHigh is 750 DefaultLow is 250

Constraint Priorities Priorities go from 1 1000 Required is 1000 @"H: -[image]- " @"V: -[image]-[caption(==image@751)]- " DefaultHigh is 750 DefaultLow is 250

Constraint Priorities Priorities go from 1 1000 Required is 1000 @"H: -[image]- " @"V: -[image]-[caption(==image@751)]- " DefaultHigh is 750 DefaultLow is 250

Constraint Priorities Priorities go from 1 1000 Required is 1000 @"H: -[image]- " @"V: -[image]-[caption(==image@751)]- " DefaultHigh is 750 DefaultLow is 250 widthconstraint.priority = UILayoutPriorityDefaultHigh + 10;

Constraint Priorities Priorities go from 1 1000 Required is 1000 @"H: -[image]- " @"V: -[image]-[caption(==image@751)]- " DefaultHigh is 750 DefaultLow is 250 Highest priority wins widthconstraint.priority = UILayoutPriorityDefaultHigh + 10;

Constraint Priorities Priorities go from 1 1000 Required is 1000 @"H: -[image]- " @"V: -[image]-[caption(==image@751)]- " DefaultHigh is 750 DefaultLow is 250 Highest priority wins System uses some priorities Set around, not equal to widthconstraint.priority = UILayoutPriorityDefaultHigh + 10;

Content Priorities

Content Priorities How a view handles its content

Content Priorities How a view handles its content By default, these are not set as required Do not set as required Can cause unsatisfiable constraints

Content Priorities How a view handles its content By default, these are not set as required Do not set as required Can cause unsatisfiable constraints Equal priorities can cause ambiguity

Content Priorities How a view handles its content By default, these are not set as required Do not set as required Can cause unsatisfiable constraints Equal priorities can cause ambiguity answer send answer Types Content hugging

Content Priorities How a view handles its content By default, these are not set as required Content hugging priorities Do not set as required Can cause unsatisfiable constraints Equal priorities can cause ambiguity answer send answer Types 250 250 Content hugging

Content Priorities How a view handles its content By default, these are not set as required Content hugging priorities Do not set as required Can cause unsatisfiable constraints Equal priorities can cause ambiguity answer send answer Types 250 250 Content hugging

Content Priorities How a view handles its content By default, these are not set as required Content hugging priorities Do not set as required Can cause unsatisfiable constraints Equal priorities can cause ambiguity answer send answer Types 250 249 Content hugging

Content Priorities How a view handles its content By default, these are not set as required Content hugging priorities Do not set as required Can cause unsatisfiable constraints Equal priorities can cause ambiguity answer send answer Types 250 249 Content hugging

Content Priorities How a view handles its content By default, these are not set as required Content hugging priorities Do not set as required Can cause unsatisfiable constraints Equal priorities can cause ambiguity answer send answer Types 250 249 251 Content hugging

Content Priorities How a view handles its content By default, these are not set as required Content hugging priorities Do not set as required Can cause unsatisfiable constraints Equal priorities can cause ambiguity answer send answer Types 250 249 251 Content hugging

Content Priorities How a view handles its content By default, these are not set as required Content hugging priorities Do not set as required Can cause unsatisfiable constraints Equal priorities can cause ambiguity answer send answer Types 250 251 Content hugging

Content Priorities How a view handles its content By default, these are not set as required Content hugging priorities Do not set as required Can cause unsatisfiable constraints Equal priorities can cause ambiguity answer send answer Types 250 251 Content hugging

Content Priorities How a view handles its content By default, these are not set as required Do not set as required Can cause unsatisfiable constraints Equal priorities can cause ambiguity Types Content hugging Compression resistance

Content Priorities How a view handles its content Compression resistance priorities By default, these are not set as required Do not set as required Can cause unsatisfiable constraints Equal priorities can cause ambiguity red Types Content hugging Compression resistance 750 750

Content Priorities How a view handles its content Compression resistance priorities By default, these are not set as required Do not set as required Can cause unsatisfiable constraints Equal priorities can cause ambiguity czerw Types Content hugging Compression resistance 750 750

Content Priorities How a view handles its content Compression resistance priorities By default, these are not set as required Do not set as required Can cause unsatisfiable constraints Equal priorities can cause ambiguity czerwony Types Content hugging Compression resistance 750 751

Priorities

Priorities Can help keep constraints from unsatisfiability

Priorities Can help keep constraints from unsatisfiability But look out for competing priorities!

Priorities Can help keep constraints from unsatisfiability But look out for competing priorities! Results are more consistent

Priorities Can help keep constraints from unsatisfiability But look out for competing priorities! Results are more consistent Use content priorities to get to the right layout

Priorities Can help keep constraints from unsatisfiability But look out for competing priorities! Results are more consistent Use content priorities to get to the right layout Hugging priorities hug content

Priorities Can help keep constraints from unsatisfiability But look out for competing priorities! Results are more consistent Use content priorities to get to the right layout Hugging priorities hug content Compression resistance resists squishing

Building the Layout Sizing constraints Views Constraints in IB Constraints in VFL Layout Engine Explicit constraints intrinsiccontentsize

Building the Layout Sizing constraints Constraint priorities Views Constraints in IB Constraints in VFL Layout Engine Explicit constraints intrinsiccontentsize

Building the Layout Constraint priorities Content priorities Sizing constraints Views Constraints in IB Constraints in VFL Layout Engine Explicit constraints intrinsiccontentsize

Alignment Mystery #6

Aligning Baselines

Aligning Baselines Use firstbaseline and lastbaseline

Aligning Baselines Use firstbaseline and lastbaseline Aligns text better than top or bottom

Aligning Baselines Use firstbaseline and lastbaseline Aligns text better than top or bottom Better control over changing views

Aligning Baselines Use firstbaseline and lastbaseline Aligns text better than top or bottom Better control over changing views Label aligned to button by bottom Button

Aligning Baselines Use firstbaseline and lastbaseline Aligns text better than top or bottom Better control over changing views Label aligned to button by bottom Add second line of text and a third while we re at it Button

Aligning Baselines Use firstbaseline and lastbaseline Aligns text better than top or bottom Better control over changing views Label aligned to button by bottom Add second line of text and a third while we re at it Button

Aligning Baselines Use firstbaseline and lastbaseline Aligns text better than top or bottom Better control over changing views Label aligned to button by bottom Add second line of text and a third while we re at it Button

Aligning Baselines Use firstbaseline and lastbaseline Aligns text better than top or bottom Better control over changing views Label aligned to button by bottom Add second line of text and a third while we re at it Button

Aligning Baselines Use firstbaseline and lastbaseline Aligns text better than top or bottom Better control over changing views Label aligned to button by bottom Button Add second line of text and a third while we re at it

Leading and Trailing One of the best photos I took on the trip. I love how the water looks like mist! Rate: Add comment

Leading and Trailing Use leading/trailing instead of left/right Helps with prep for localization One of the best photos I took on the trip. I love how the water looks like mist! Rate: Add comment

Leading and Trailing Tied to left and right Use leading/trailing instead of left/right Helps with prep for localization یکی از بهترین عکس.هایی که در سفر گرفتم حالت آب را که شبیه مه!است خیلی دوست دارم پیشنهاد دهید :امتیاز

Leading and Trailing Tied Tied to leading to left and right trailing Use leading/trailing instead of left/right Helps with prep for localization یکی از یکی از بهترین بهترین عکس عکس هایی که.هاییدر که در سفر سفر گرفتم. گرفتم حالت آب حالت را که آب را که شبیه مه شبیه مه!استاست خیلی خیلی دوست دوست دارم دارم! امتیاز: پیشنهاد دهید

Alignment Rects Tap to choose character

Alignment Rects Usually (not always) same as frame Tap to choose character

Alignment Rects Usually (not always) same as frame Includes the critical content only Tap to choose character

Alignment Rects Usually (not always) same as frame Includes the critical content only Does not change when view is transformed Tap to choose character

Alignment Rects Usually (not always) same as frame Includes the critical content only Does not change when view is transformed Tap to choose character

Alignment Rects Usually (not always) same as frame Includes the critical content only Does not change when view is transformed Override alignmentrectinsets if needed Tap to choose character

Alignment Rects Usually (not always) same as frame Includes the critical content only Does not change when view is transformed Override alignmentrectinsets if needed Find out the calculated rects Tap to choose character

Alignment Rects Usually (not always) same as frame Includes the critical content only Does not change when view is transformed Override alignmentrectinsets if needed Find out the calculated rects Use Show Alignment Rectangles in Debug menu

Alignment Rects Usually (not always) same as frame Includes the critical content only Does not change when view is transformed Override alignmentrectinsets if needed Find out the calculated rects Use Show Alignment Rectangles in Debug menu

Alignment Rects Usually (not always) same as frame Includes the critical content only Does not change when view is transformed Override alignmentrectinsets if needed Find out the calculated rects Use Show Alignment Rectangles in Debug menu Get using alignmentrectforframe:

Alignment Rects Usually (not always) same as frame Includes the critical content only Does not change when view is transformed Override alignmentrectinsets if needed Find out the calculated rects Use Show Alignment Rectangles in Debug menu Get using alignmentrectforframe: More in Part 2

Alignment

Alignment First and last baseline for better aligned text

Alignment First and last baseline for better aligned text Leading and trailing instead of left and right

Alignment First and last baseline for better aligned text Leading and trailing instead of left and right Override alignmentrectinsets to adjust alignment rects

Building the Layout Constraint priorities Content priorities Sizing constraints Views Constraints in IB Constraints in VFL Layout Engine Explicit constraints intrinsiccontentsize

Building the Layout Constraint priorities Content priorities Sizing constraints Views Constraints in IB Constraints in VFL Explicit constraints Layout Engine Horizontal alignment Vertical alignment Baseline alignment intrinsiccontentsize

Building the Layout Constraint priorities Content priorities Sizing constraints Views Alignment rect insets Constraints in IB Constraints in VFL Explicit constraints Layout Engine Horizontal alignment Vertical alignment Baseline alignment intrinsiccontentsize

Building the Layout Layout Engine

Building the Layout Layout Engine

Building the Layout Layout Engine Alignment The Engine rects

Building the Layout Layout Engine Alignment The Engine rects Your Layout

Building the Layout Your Layout

Summary

Summary Stack Views help build easily maintainable layouts

Summary Stack Views help build easily maintainable layouts Use activate and deactivate for constraints

Summary Stack Views help build easily maintainable layouts Use activate and deactivate for constraints Determine size through constraints

Summary Stack Views help build easily maintainable layouts Use activate and deactivate for constraints Determine size through constraints Override intrinsiccontentsize judiciously

Summary Stack Views help build easily maintainable layouts Use activate and deactivate for constraints Determine size through constraints Override intrinsiccontentsize judiciously Use priorities to properly solve your layout

Summary Stack Views help build easily maintainable layouts Use activate and deactivate for constraints Determine size through constraints Override intrinsiccontentsize judiciously Use priorities to properly solve your layout Alignment goes beyond top, bottom, and center

Summary Stack Views help build easily maintainable layouts Use activate and deactivate for constraints Determine size through constraints Override intrinsiccontentsize judiciously Use priorities to properly solve your layout Alignment goes beyond top, bottom, and center Keep localization in mind

More Information Documentation and Videos Swift Language Documentation http://developer.apple.com/swift Sample Code AstroLayout http://developer.apple.com/library/ prerelease/ios/samplecode/astrolayout Technical Support Apple Developer Forums http://devforums.apple.com General Inquiries Paul Marcos, App Frameworks Evangelist pmarcos@apple.com

Related Sessions Mysteries of Auto Layout, Part 2 Presidio Thursday 1:30PM What s New in Cocoa Presidio Tuesday 1:30PM What s New in UIKit Dynamics and Visual Effects Mission Friday 10:00AM Cocoa Touch Best Practices Presidio Friday 1:30PM What s New in Internationalization Pacific Heights Friday 9:00AM New UIKit Support for International User Interfaces Nob Hill Thursday 2:30PM

Labs Interface Builder and Auto Layout Lab Developer Tools Lab C Thursday 2:30PM