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
180
NoSQL & MongoDB
liushuaikobe
0
180
Other Decks in Technology
See All in Technology
A4)シラバスを超えて語る、テストマネジメント
moritamasami
0
120
スピンアウト講座03_CLAUDE-MDとSKILL-MD
overflowinc
0
1.1k
Bill One 開発エンジニア 紹介資料
sansan33
PRO
5
18k
脳が溶けた話 / Melted Brain
keisuke69
1
820
20260320_JaSST26_Tokyo_登壇資料.pdf
mura_shin
0
110
ABEMAのバグバウンティの取り組み
kurochan
1
480
_Architecture_Modernization_から学ぶ現状理解から設計への道のり.pdf
satohjohn
2
710
Kiroで見直す開発プロセスとAI-DLC
k_adachi_01
0
120
形式手法特論:SMT ソルバで解く認可ポリシの静的解析 #kernelvm / Kernel VM Study Tsukuba No3
ytaka23
1
750
Agent Skill 是什麼?對軟體產業帶來的變化
appleboy
0
210
Phase09_自動化_仕組み化
overflowinc
0
1.4k
GitHub Copilot CLI で Azure Portal to Bicep
tsubakimoto_s
0
180
Featured
See All Featured
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
61
43k
Paper Plane
katiecoart
PRO
0
48k
Optimizing for Happiness
mojombo
378
71k
Prompt Engineering for Job Search
mfonobong
0
220
Fireside Chat
paigeccino
42
3.8k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
93
Java REST API Framework Comparison - PWX 2021
mraible
34
9.2k
Building AI with AI
inesmontani
PRO
1
820
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
160
Chasing Engaging Ingredients in Design
codingconduct
0
150
The SEO identity crisis: Don't let AI make you average
varn
0
420
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