Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Auto Layout in iOS
Search
Sam Kirchmeier
September 12, 2013
Programming
3
130
Auto Layout in iOS
Introduction to Auto Layout in iOS
Sam Kirchmeier
September 12, 2013
Tweet
Share
More Decks by Sam Kirchmeier
See All by Sam Kirchmeier
Exploring Stateless UIs in Swift
skirchmeier
2
520
Beyond REST: Web Services Designed for Mobile
skirchmeier
2
120
Physics-Based Interfaces with UIKit Dynamics
skirchmeier
0
100
Bluetooth LE, Core Bluetooth, and a Glimpse Into Your Near Future
skirchmeier
0
250
Building HTML5 Tablet Apps
skirchmeier
2
500
iOS Training Part 2
skirchmeier
1
200
Custom iOS Controls
skirchmeier
3
180
Other Decks in Programming
See All in Programming
見せてあげますよ、「本物のLaravel批判」ってやつを。
77web
7
7.8k
色々なIaCツールを実際に触って比較してみる
iriikeita
0
330
Webの技術スタックで マルチプラットフォームアプリ開発を可能にするElixirDesktopの紹介
thehaigo
2
1k
C++でシェーダを書く
fadis
6
4.1k
광고 소재 심사 과정에 AI를 도입하여 광고 서비스 생산성 향상시키기
kakao
PRO
0
170
2024/11/8 関西Kaggler会 2024 #3 / Kaggle Kernel で Gemma 2 × vLLM を動かす。
kohecchi
5
930
Ethereum_.pdf
nekomatu
0
460
とにかくAWS GameDay!AWSは世界の共通言語! / Anyway, AWS GameDay! AWS is the world's lingua franca!
seike460
PRO
1
900
subpath importsで始めるモック生活
10tera
0
310
Arm移行タイムアタック
qnighy
0
330
イベント駆動で成長して委員会
happymana
1
330
Remix on Hono on Cloudflare Workers
yusukebe
1
300
Featured
See All Featured
Happy Clients
brianwarren
98
6.7k
How STYLIGHT went responsive
nonsquared
95
5.2k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
27
4.3k
Optimizing for Happiness
mojombo
376
70k
Into the Great Unknown - MozCon
thekraken
32
1.5k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
329
21k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
VelocityConf: Rendering Performance Case Studies
addyosmani
325
24k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
Building Better People: How to give real-time feedback that sticks.
wjessup
364
19k
RailsConf 2023
tenderlove
29
900
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Transcript
Auto Layout Sam Kirchmeier @skirchmeier Adam May @yammada Friday, September
27, 13
Friday, September 27, 13
Lineup Auto Layout crash course Ways to use it Demos
& discussion Friday, September 27, 13
Auto Layout Friday, September 27, 13
Friday, September 27, 13
Alternative to Springs & Struts Friday, September 27, 13
Alternative to Springs & Struts Relationships instead of frames Friday,
September 27, 13
Alternative to Springs & Struts Relationships instead of frames Layout
is resolved automatically Friday, September 27, 13
Alternative to Springs & Struts Relationships instead of frames Layout
is resolved automatically Magic Friday, September 27, 13
Who’s used it? Friday, September 27, 13
Why? Friday, September 27, 13
Friday, September 27, 13
Easy Friday, September 27, 13
Easy Versatile Friday, September 27, 13
Easy Versatile Descriptive Friday, September 27, 13
Easy Versatile Descriptive Localizable Friday, September 27, 13
Springs & Struts Auto Layout Friday, September 27, 13
Springs & Struts Auto Layout Hard-coded Friday, September 27, 13
Springs & Struts Auto Layout Hard-coded Content-driven Friday, September 27,
13
Springs & Struts Auto Layout Hard-coded Isolated Views Content-driven Friday,
September 27, 13
Springs & Struts Auto Layout Hard-coded Isolated Views Content-driven Related
Views Friday, September 27, 13
Springs & Struts Auto Layout Hard-coded Isolated Views autoResizingMask Content-driven
Related Views Friday, September 27, 13
Springs & Struts Auto Layout Hard-coded Isolated Views autoResizingMask Content-driven
Related Views Constraints Friday, September 27, 13
Springs & Struts Auto Layout Hard-coded Isolated Views autoResizingMask Familiar
Content-driven Related Views Constraints Friday, September 27, 13
Springs & Struts Auto Layout Hard-coded Isolated Views autoResizingMask Familiar
Content-driven Related Views Constraints Scary Friday, September 27, 13
Constraints Friday, September 27, 13
Scary Friday, September 27, 13
Scary Friday, September 27, 13
Scary Friday, September 27, 13
Scary attribute attribute == x multiplier + constant Friday, September
27, 13
Scary attribute attribute == x multiplier + constant Friday, September
27, 13
Scary attribute == x multiplier + constant top Friday, September
27, 13
Scary attribute == x multiplier + constant top Friday, September
27, 13
Scary attribute == x multiplier + constant top Friday, September
27, 13
Scary == x multiplier + constant top top Friday, September
27, 13
Scary == x multiplier + constant top top Friday, September
27, 13
Scary == x + constant top top 1.0 Friday, September
27, 13
Scary == + constant top top Friday, September 27, 13
Scary == + top top standard Friday, September 27, 13
Scary == + top top standard Friday, September 27, 13
Scary == + top top standard le! le! == +
standard Friday, September 27, 13
Scary == + top top standard le! le! == +
standard Same behavior as Springs & Struts No frame necessary Friday, September 27, 13
Le! Top Baseline Width Center X Right Bottom None Height
Center Y Friday, September 27, 13
Le! Top Baseline Width Center X Right Bottom None Height
Center Y Leading Trailing Friday, September 27, 13
Scary Friday, September 27, 13
!"#$ Friday, September 27, 13
Unsatisfiability Friday, September 27, 13
Ambiguity Friday, September 27, 13
Content Hugging Compression Resistance Intrinsic Content Size Friday, September 27,
13
Priorities Friday, September 27, 13
Ways to use it Interface Builder NSLayoutConstraint Visual Format Language
Friday, September 27, 13
Interface Builder Friday, September 27, 13
NSLayoutConstraint Friday, September 27, 13
NSLayoutConstraint + (id)constraintWithItem:(id)view1 attribute:(NSLayoutAttribute)attr1 relatedBy:(NSLayoutRelation)relation toItem:(id)view2 attribute:(NSLayoutAttribute)attr2 multiplier:(CGFloat)multiplier constant:(CGFloat)constant; Friday,
September 27, 13
[NSLayoutConstraint constraintWithItem:view1 attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:view2 attribute:NSLayoutAttributeTop multiplier:1.0 constant:20.0]; == x
1.0 + 20.0 top top Friday, September 27, 13
[NSLayoutConstraint constraintWithItem:view1 attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:view2 attribute:NSLayoutAttributeTop multiplier:1.0 constant:20.0]; == x
1.0 + 20.0 top top Friday, September 27, 13
[NSLayoutConstraint constraintWithItem:view1 attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:view2 attribute:NSLayoutAttributeTop multiplier:1.0 constant:20.0]; == x
1.0 + 20.0 top top Friday, September 27, 13
[NSLayoutConstraint constraintWithItem:view1 attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:view2 attribute:NSLayoutAttributeTop multiplier:1.0 constant:20.0]; == x
1.0 + 20.0 top top Friday, September 27, 13
[NSLayoutConstraint constraintWithItem:view1 attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:view2 attribute:NSLayoutAttributeTop multiplier:1.0 constant:20.0]; == x
1.0 + 20.0 top top Friday, September 27, 13
[NSLayoutConstraint constraintWithItem:view1 attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:view2 attribute:NSLayoutAttributeTop multiplier:1.0 constant:20.0]; == x
1.0 + 20.0 top top Friday, September 27, 13
Visual Format Language Friday, September 27, 13
[label]-[textField] Friday, September 27, 13
|-[label]-| Friday, September 27, 13
V:|-(40)-[logo] Friday, September 27, 13
|-(40)-[logo]-[label]-[textField(>=20)]-| Friday, September 27, 13
[NSLayoutConstraint constraintsWithVisualFormat:@"|-[label]" options:0 metrics:nil views:views]; [NSLayoutConstraint constraintsWithVisualFormat:@"V:|-[label]" options:0 metrics:nil views:views];
Friday, September 27, 13
Demo Localization Friday, September 27, 13
Demo Free Form Editor Friday, September 27, 13
UITextView UIScrollView UIMapView Friday, September 27, 13
UITextView UIScrollView UIMapView Friday, September 27, 13
UIImageView UIView Friday, September 27, 13
Z UIScrollView UIImageView UIScrollView contentSize Friday, September 27, 13
Demo Free Form Editor Friday, September 27, 13
Constraint Stacking Friday, September 27, 13
UITextView UIScrollView UIMapView Image Views Friday, September 27, 13
UIImageView UIImageView UIImageView Friday, September 27, 13
UIImageView UIImageView ? ? Friday, September 27, 13
UIImageView UIImageView UIImageView Friday, September 27, 13
UIImageView UIImageView UIImageView ≥20 ≥20 ≥20 Friday, September 27, 13
UIImageView UIImageView ≥20 ≥20 Friday, September 27, 13
Demo Constraint Stacking Friday, September 27, 13
Interface Builder Quirks Friday, September 27, 13
Friday, September 27, 13
Easy to accidentally delete outlets Friday, September 27, 13
Easy to accidentally delete outlets Does not allow ambiguity Friday,
September 27, 13
Easy to accidentally delete outlets Does not allow ambiguity Adds
minimum best constraints Friday, September 27, 13
Easy to accidentally delete outlets Does not allow ambiguity Adds
minimum best constraints Automatically promotes constraints Friday, September 27, 13
Easy to accidentally delete outlets Does not allow ambiguity Adds
minimum best constraints Automatically promotes constraints Automatically deletes constraints Friday, September 27, 13
Interface Builder Tips Friday, September 27, 13
Friday, September 27, 13
Friday, September 27, 13
Change to portrait/landscape/freeform Friday, September 27, 13
Change to portrait/landscape/freeform Promote constraints to User Constraints Friday, September
27, 13
Change to portrait/landscape/freeform Promote constraints to User Constraints Learn to
expect what IB will do Friday, September 27, 13
Change to portrait/landscape/freeform Promote constraints to User Constraints Learn to
expect what IB will do Size to fit content Friday, September 27, 13
Change to portrait/landscape/freeform Promote constraints to User Constraints Learn to
expect what IB will do Size to fit content Wait for Xcode 5 Friday, September 27, 13
Recap Introduced Auto Layout Ways to use it Demos Friday,
September 27, 13
Discussion https://github.com/livefront/autolayout Sam Kirchmeier @skirchmeier Adam May @yammada Friday, September
27, 13