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
Shuai Liu
September 22, 2015
Technology
2
130
Auto-Layout.pdf
Shuai Liu
September 22, 2015
Tweet
Share
More Decks by Shuai Liu
See All by Shuai Liu
Python-intro-2
liushuaikobe
0
79
Python-intro-1
liushuaikobe
0
74
GitRadar——毕业论文答辩
liushuaikobe
0
190
NoSQL & MongoDB
liushuaikobe
0
180
Other Decks in Technology
See All in Technology
AI時代のIssue駆動開発のススメ
moongift
PRO
0
290
FastMCP OAuth Proxy with Cognito
hironobuiga
3
220
なぜarray_firstとarray_lastは採用、 array_value_firstとarray_value_lastは 見送りだったか / Why array_value_first and array_value_last was declined, then why array_first and array_last was accpeted?
cocoeyes02
0
270
DDD×仕様駆動で回す高品質開発のプロセス設計
littlehands
6
2.7k
BFCacheを活用して無限スクロールのUX を改善した話
apple_yagi
0
130
Bill One 開発エンジニア 紹介資料
sansan33
PRO
5
18k
Why we keep our community?
kawaguti
PRO
0
330
Amazon Qはアマコネで頑張っています〜 Amazon Q in Connectについて〜
yama3133
1
150
「通るまでRe-run」から卒業!落ちないテストを書く勘所
asumikam
3
850
「捨てる」を設計する
kubell_hr
0
440
Even G2 クイックスタートガイド(日本語版)
vrshinobi1
0
120
会社紹介資料 / Sansan Company Profile
sansan33
PRO
16
410k
Featured
See All Featured
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
1
1.5k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
230
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Building Flexible Design Systems
yeseniaperezcruz
330
40k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
140
The Language of Interfaces
destraynor
162
26k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
150
How to train your dragon (web standard)
notwaldorf
97
6.6k
Marketing to machines
jonoalderson
1
5.1k
The Spectacular Lies of Maps
axbom
PRO
1
650
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
90
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