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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Shuai Liu
September 22, 2015
Technology
130
2
Share
Auto-Layout.pdf
Shuai Liu
September 22, 2015
More Decks by Shuai Liu
See All by Shuai Liu
Python-intro-2
liushuaikobe
0
81
Python-intro-1
liushuaikobe
0
76
GitRadar——毕业论文答辩
liushuaikobe
0
190
NoSQL & MongoDB
liushuaikobe
0
180
Other Decks in Technology
See All in Technology
インターネットのガバナンスと応用 / Internet Governance and Applications
ks91
PRO
0
110
色を視る
yuzneri
0
320
多角的な視点から見たAGI
terisuke
0
120
SLI/SLO、「完全に理解した」から「チョットデキル」へ
maruloop
1
110
AI駆動開発で生産性を追いかけたら、行き着いたのは品質とシフトレフトだった
littlehands
0
390
EMから幅を広げるために最近挑戦していること / Recent challenges I'm undertaking to expand my horizons beyond EM
hiro_torii
1
180
「SaaSの次の時代」に重要性を増すステークホルダーマネジメントの要諦 ~解像度を圧倒的に高めPdMの価値を最大化させる方法~
kakehashi
PRO
3
3.8k
AIが自律的に働く時代へ Amazon Quick で実現するAIエージェント紹介
koheiyoshikawa
0
180
音声言語モデル手法に関する発表の紹介
kzinmr
0
160
Microsoft 365 / Microsoft 365 Copilot : 自分の状態を確認する「ラベル」について
taichinakamura
0
460
独断と偏見で試してみる、 シングル or マルチエージェント どっちがいいの?
shichijoyuhi
1
240
Digital Independence: Why, When and How
wannesrams
0
290
Featured
See All Featured
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.4k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
Designing for Timeless Needs
cassininazir
0
210
How GitHub (no longer) Works
holman
316
150k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
160
Crafting Experiences
bethany
1
140
Context Engineering - Making Every Token Count
addyosmani
9
860
Navigating Weather and Climate Data
rabernat
0
180
Accessibility Awareness
sabderemane
1
110
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
180
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
400
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