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.pdf
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
87
Python-intro-1
liushuaikobe
0
85
GitRadar——毕业论文答辩
liushuaikobe
0
210
NoSQL & MongoDB
liushuaikobe
0
190
Other Decks in Technology
See All in Technology
プロンプト_きのこカンファレンス2026_LT
yurufuwahealer
0
150
しぶいSRE: サーバから見えない障害にどう向き合うか。ラストワンマイルのデバッグ実践 / Shibui SRE
kanny
12
5.3k
ポストモーテム! DDoSからサイトは守れた。 でもビジネスは守れなかった。
bengo4com
0
2.1k
どうして今サーバーサイドKotlinを選択したのか
nealle
0
210
認証認可だけじゃない! ID管理の構成要素と ライフサイクルを意識しよう
ritou
1
530
Docker Desktop不要の時代が来る? WSL標準の「wslc」で Linuxコンテナを動かしてみた.
ueponx
0
830
Foxgloveについて 実際にExtensionを開発して公開するまでの話 / About Foxglove: The Story of Developing and Releasing an Extension
ry0_ka
0
190
SRE歴2ヶ月でも開発6年の知見を活かして、チームで止まっていた環境改善を前に進めた話
a_ono
1
220
End-to-Endで考える信頼性 —LINEアプリにおけるクライアント開発×SRE連携の実践
maruloop
4
3.4k
20260702_生成AIはどこまで成長するのか_チャットだけじゃない世界
doradora09
PRO
0
110
SRE Lounge Hiroshimaへの招待
grimoh
0
430
プロダクトだけじゃない、社内プロセスにおける自動化・省力化ノススメ
kakehashi
PRO
1
3.1k
Featured
See All Featured
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
300
For a Future-Friendly Web
brad_frost
183
10k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
550
Six Lessons from altMBA
skipperchong
29
4.3k
Designing Experiences People Love
moore
143
24k
Scaling GitHub
holman
464
140k
4 Signs Your Business is Dying
shpigford
187
22k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.5k
Chasing Engaging Ingredients in Design
codingconduct
0
230
[SF Ruby Conf 2025] Rails X
palkan
2
1.1k
The browser strikes back
jonoalderson
0
1.4k
Paper Plane
katiecoart
PRO
1
52k
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