Under the Bridge

Tips: Auto Layout

Had some … issues … getting iOS 6 auto layout to work quite the way you expect? Nope, you’re not alone.

Screen Shot 2012-11-29 at 6.49.38 PM.png

Here’s a couple posts with some helpful tips:

Auto Layout & Interface Builder Tutorial: Solving some common problems

IB has a few quirks (some would say large number of flaws) which can make it seem like black magic trying to bend it to your will…

Issues With Achieving Auto Layout Zen

I’ve had better luck trying to read women in my failed relationships than trying to debug why my constraints aren’t working out…

Tip: Manually Adding iOS 6 Auto Layout Constraints

Tip: Ambiguous Auto Layouts in iOS 6

If you haven’t really got into this auto layout thing yet, the best introductory tutorials are at raywenderlich.com, exactly where you would expect by now:

Beginning Auto Layout in iOS 6: Part 1/2 and Part 2/2

And finally, if you think this auto layout stuff sounds kinda nifty but are stuck targeting iOS 5, might want to take a gander at

RRAutoLayout

RRTestApp has constraints based layout and all constrains added in interface builder like you normally would do for iOS6, whats interesting is that it has deployment target iOS5. You can run same project on iOS6 and iOS5 and it should look and behave (when rotating) the same. Essentially its iOS6 Auto Layout) back port to iOS5…

And always keep up with Apple’s documentation, particularly Auto Layout Guide and IB’s Auto Layout Help.

UPDATES:

KeepLayout: Library Making iOS 6 Auto-Layout Extremely Easy To Use Programmatically

⌘⇧ – Command Shift series:

FLKAutoLayout: “is a category on UIView which makes it easy to setup layout constraints in code.”

10 Things You Need To Know About Cocoa Auto Layout

Auto Layout Performance on iOS; Optimising Auto Layout

Masonry: Open Source Library That Makes It Easer To Work With iOS Auto Layout

objc.io #3: Advanced Auto Layout Toolbox

XCODE 5 / IOS 7 UPDATES:

Our Xcode 5 Collection mentions iOS 7 Tutorial Series: Auto Layout in Xcode 5 and Using Storyboards

iOS 7 Tutorial Series: Auto Layout in Xcode 5

SKCore – a Simplification Toolset (Core Graphics, Auto Layout and More)

Use Auto-layout In Xcode 5 For Interfaces That Adapt To Different Screens/Orientations; A Series Of Examples On Using The iOS Auto-Layout Feature Programmatically

Tutorial: How To Easily Set Up Scrolling Content Within A UIScrollView Using Auto-Layout

I Stopped Using NIBs Thanks to Auto Layout

Parus: “is a small objective-c DSL for Auto Layout in code.”

Reconciling iOS 6 and iOS 7 with Interface Builder

Tutorial: Auto Layout Part 1

Mastering programmatic Auto Layout without going insane…

Auto-Layout-Demystified: repo for iOS Auto Layout Demystified (2nd Edition)

XCODE 6 / IOS 8 UPDATES:

Our Layout Best Practices, iPhone 6 Screen Apoplexia, Xcode 6 Custom Interface Builder Previews , Storyboard Launch Images

NB. to use setNeedsUpdateConstraints/updateViewConstraints now, not setNeedsLayout/layoutSubviews!

ASCIIwwdc’s 60 Results for ‘auto layout’, most recently

raywenderlich.com’s Auto Layout Tutorial Part 1: Getting Started and Part 2: Constraints now updated to Xcode 6.3 + Swift 1.2

Xcode 6: Live Rendering, Visual View Debugging, and Swift

iOS: How To Make AutoLayout Work On A ScrollView

Building Adaptive User Interfaces for iOS 8

Working with iOS 6 Auto Layout Constraints in Interface Builder

Creating the four UITableViewCellStyles using AutoLayout

UICustomResolutions extension for UIWindow

How to Use UIViews With Auto Layout Programmatically

Dynamic Table View Cell Height and Auto Layout (updated to iOS 8)

Auto layout best practices for minimum pain

Tutorial: How to use Auto Layout in Xcode 6

Emulating aspect-fit behaviour using Auto Layout constraints in Xcode 6

Percentage Widths And Centering in Autolayout with XCode 6

Adaptive Layouts For iPhone 6

iOS8 Layout Margins; Xcode 6 Auto Layout Margin Annoyances

Adaptive user interfaces

Self Sizing Table View Cells; Understanding Self Sizing Cells and Dynamic Type in iOS 8

Storyboards in Xcode 6; Storyboards Tutorial in Swift: Part 1

Unwind Segues in iOS Storyboards; iOS: How To Pass Data with an Unwind Segue

AutoLayoutBasics: How to Use Auto Layout in XCode 6 for iOS 7 and 8 Development; Auto Layout Advanced Techniques for iOS 8 and 7 using XCode 6 on Storyboard

A Guide On The Basics Of Using The Visual Format Language For Auto-Layout

Cartography: Open Source Swift Library Allowing You To Create Complex Auto Layout Layouts from Code

SnapKit: Open Source Swift Library That Greatly Simplifies Working With Auto Layout port of Masonry(above).

Dynamic UITableViewCell | Swift

Porting Your App to the iPhone 6, iPhone 6 Plus and iOS 8: Top 10 Tips “Adopting Adaptive Layout and the Universal Storyboard”

Sizing class for iPad portrait and Landscape Modes

Size Classes Tutorial

Adaptive Auto Layout

Custom Live Views and Auto Layout

How can Xcode 6 adaptive UIs be backwards-compatible with iOS 7 and iOS 6?

“IB started respecting the “relative to margin” option for constraints starting in 8.3” may explain your cells looking different.

Restraint: “Minimal Auto Layout in Swift”

Manuscript: “It’s like AutoLayoutKit but written in Swift. For pure Swift projects. And it’s super simple.”

Animating Auto Layout Constraints

3