Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Auto-Layout.pdf
Search
Shuai Liu
September 22, 2015
Technology
140
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Auto-Layout.pdf
Shuai Liu
September 22, 2015
More Decks by Shuai Liu
See All by Shuai Liu
Python-intro-2
liushuaikobe
0
95
Python-intro-1
liushuaikobe
0
90
GitRadar——毕业论文答辩
liushuaikobe
0
230
NoSQL & MongoDB
liushuaikobe
0
210
Other Decks in Technology
See All in Technology
OpenTelemetryのメトリクスをCloudWatchに送ってPromQLで見てみた
ota1022
0
150
絵ではじめるKubernetesセキュリティ
aoi1
3
560
iOSDC Japan 2026 day1 TrackC 10:50
feedtailor
1
160
あるけみー式LTスライド作成術
alchemy1115
1
210
OpenTelemetry eBPF Instrumentationの舞台裏 / Behind the Scenes of OpenTelemetry eBPF Instrumentation
ymotongpoo
4
1.3k
バイブコーディング時代のWebアプリ開発入門~Cloud Runで学ぶセキュアなビルドとデプロイ
waiwai2111
1
120
What the customer really needed
kawaguti
PRO
1
170
10Xに技術的負債をもたらした「2つの境界の歪み」その構造と解消への営み
10xinc
0
1.9k
Claude in Chrome 入門 / Introduction to Claude in Chrome
cielo1985
0
810
事業課題から技術的負債に向き合う
sansantech
PRO
2
1.8k
Omarchy Quattro の日本語設定周り
simosako
2
180
HRC_Frontend_Conference_Fukuoka_2026.pdf
ts020
0
720
Featured
See All Featured
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
240
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
330
Producing Creativity
orderedlist
PRO
348
41k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
68
57k
Building Adaptive Systems
keathley
44
3.2k
Done Done
chrislema
186
16k
Raft: Consensus for Rubyists
vanstee
142
7.7k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Context Engineering - Making Every Token Count
addyosmani
9
1.1k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.3k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
520
Transcript
Auto Layout
Frame + autoresizingMask Auto Layout
basis • SuperView的位置确定了,那么SubView的位置就可 以被确定 • SuperView -> SubView的{x, y, width,
height} -> SubView的位置
Cassowary You provide rules, whether through IB or through code,
and the Auto Layout system transforms those rules into view frames.
Constraint y = kx + b view1的某个属性 = k ×
view2的某个属性 + b
NSLayoutConstraint + (instancetype)constraintWithItem:(id)view1 attribute:(NSLayoutAtribute)attr1 relatedBy:(NSLayoutRelation)relation toItem:(id)view2 attribute:(NSLayoutAttribute)attr2 multiplier:(CGFloat)multipler constant:(CGFloat)c
开始Auto Layout • No frame & autoresizingMask • ⽗父View当前的⼤大⼩小是不可靠的
None
思路 • 合理的把⼦子View分组 • 确定⼤大致依赖关系 —— 要想确定A的位置,⾸首先我得知道B 的位置 & 只要B的位置定下来了,那么A的位置就可以被确定
• 找出那些只依赖⽗父View的View(⼀一定存在),先 添加他们的约束 • 根据依赖关系,⼀一级⼀一级的添加约束
None
None
None
Code
Advanced • Content Hugging & Compression Resistance • Intrinsic Content
Size • Animation