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
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
91
Python-intro-1
liushuaikobe
0
89
GitRadar——毕业论文答辩
liushuaikobe
0
220
NoSQL & MongoDB
liushuaikobe
0
200
Other Decks in Technology
See All in Technology
平文パスワードはログに“残り” ── 肝心の侵入は“痕跡すら残らない”
kuroneko13
0
130
作って理解するCoding Agent 〜フレームワークに頼らないピュア Python での実装〜
takapy
4
1.3k
EUDIWの枠組みを出発点に民間エコシステムの在り方を考える(OAuth/OIDC Numa (Immersion) Workshop 2026)
oidfj
PRO
0
270
AI開発に用いられるHPC技術について
gpuunite_official
0
290
ハッカソンで入賞した話 @ Findy LT
asari194617
0
1.5k
パスキーでドライブする アカウント統合(OAuth/OIDC Numa (Immersion) Workshop 2026)
oidfj
PRO
0
280
巨大気象データと戦う ― サロゲートモデル学習を高速化する圧縮技術
gpuunite_official
0
280
Rust×eBPFでEDRっぽいものをつくる
sunlife3
2
970
Introduction to Sansan Meishi Maker Development Engineer
sansan33
PRO
0
460
AWS Blocks が楽しい #ゆるWeb札幌
tacck
PRO
0
150
顧客の要望は2次情報である 〜アンテナを張るFDEの構造論〜
noriakioji
2
660
MCPを待つな、パスキーを拡げよう(OAuth/OIDC Numa (Immersion) Workshop 2026)
oidfj
PRO
0
270
Featured
See All Featured
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
340
The Mindset for Success: Future Career Progression
greggifford
PRO
0
480
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
4 Signs Your Business is Dying
shpigford
187
23k
RailsConf 2023
tenderlove
30
1.5k
Into the Great Unknown - MozCon
thekraken
41
2.7k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
260
Unsuck your backbone
ammeep
672
58k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
250
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
250
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