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
Intermediate Auto Layout
Search
Peter Stuart
December 12, 2013
Technology
0
250
Intermediate Auto Layout
Talk given at CocoaHeads Boston.
Peter Stuart
December 12, 2013
Tweet
Share
Other Decks in Technology
See All in Technology
インシデントレスポンスのライフサイクルを廻すポイントってなに / Pinpoints of Incidentresponse Lifecycle for Operation
sakaitakeshi
1
300
0→1開発における技術選定において一番大切なこと
bicstone
1
330
シン・Kafka / shin-kafka
oracle4engineer
PRO
7
2.7k
株式会社EventHub・エンジニア採用資料
eventhub
0
1.9k
[2024年3月版] Databricksのシステムアーキテクチャ
databricksjapan
8
1.9k
Google Cloud の AI を支える裏側のインフラを垣間見る!
maroon1st
0
190
DevOpsDays History and my DevOps story
kawaguti
PRO
8
1.6k
OpenTelemetry を使ったトレースエグザンプラーの活用 / otel-trace-exemplar
k6s4i53rx
2
640
Vertex AI を中心に 生成AIのアップデートを共有します
kaz1437
0
140
プロトタイピングによる不確実性の低減 / Reducing Uncertainty through Prototyping
ohbarye
3
240
オブザーバビリティの Primary Signals
onk
PRO
0
550
反実仮想機械学習とは何か
usaito
PRO
7
2.2k
Featured
See All Featured
RailsConf 2023
tenderlove
2
530
Imperfection Machines: The Place of Print at Facebook
scottboms
258
12k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
60
14k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
154
14k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
15
1.4k
How GitHub Uses GitHub to Build GitHub
holman
468
290k
Reflections from 52 weeks, 52 projects
jeffersonlam
344
19k
Making Projects Easy
brettharned
108
5.5k
Into the Great Unknown - MozCon
thekraken
10
980
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
1
3.4k
Build The Right Thing And Hit Your Dates
maggiecrowley
23
2k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
24
2.3k
Transcript
Intermediate Auto Layout
Layout Guides
Layout Guides id topLayoutGuide = self.topLayoutGuide; NSDictionary *views = NSDictionaryOfVariableBindings(topLayoutGuide,
someView); ... @"V:[topLayoutGuide]-[someView]" ...
Scroll Views
Scroll Views
Scroll Views [NSLayoutConstraint constraintWithItem:container attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:scrollView attribute:NSLayoutAttributeWidth multiplier:1 constant:0];
Scroll Views - (void)keyboardWillShow:(NSNotification *)notification { CGFloat offset = ...;
self.bottomConstraint.constant = offset; [UIView animate...:^{ [self.view layoutIfNeeded]; }]; }
Custom Views • Should know their intrinsic size • constraints
• intrinsicContentSize
Custom Views • Should know how to be laid out
• alignmentRectInsets
Custom Views return UIEdgeInsetsMake(25, 0, 0, 25); 1
Compression Resistance This is some pretty long text. Low High
High
Compression Resistance This is some … Low High High
Compression Resistance [view setContentCompressionResistancePriority:UILayoutPriorityDefaultLow forOrientation:UILayoutConstraintOrientationHorizontal];
Hugging Text Text Low High High Text
Hugging Text Text Low High High Text
Hugging [view setContentHuggingPriority:UILayoutPriorityDefaultLow forOrientation:UILayoutConstraintOrientationHorizontal] ;
Misc. • Align views/controls that contain text using NSLayoutAttributeBaseline, not
NSLayoutAttributeCenterY • Manage constraints with views, not view controllers • Avoid using explicit sizes