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
110
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
57
Python-intro-1
liushuaikobe
0
52
GitRadar——毕业论文答辩
liushuaikobe
0
160
NoSQL & MongoDB
liushuaikobe
0
97
Other Decks in Technology
See All in Technology
大規模データ基盤チームのオンプレTiDB運用への挑戦 / dpu-tidb
cyberagentdevelopers
PRO
1
110
【技術書典17】OpenFOAM(自宅で極める流体解析)2次元円柱まわりの流れ
kamakiri1225
0
210
君は隠しイベントを見つけれるか?
mujyun
0
290
[AWS JAPAN 生成AIハッカソン] Dialog の紹介
yoshimi0227
0
150
Shift-from-React-to-Vue
calm1205
3
1.3k
APIテスト自動化の勘所
yokawasa
7
4.2k
Jr. Championsになって、強く連携しながらAWSをもっと使いたい!~AWSに対する期待と行動~
amixedcolor
0
190
CAMERA-Suite: 広告文生成のための評価スイート / ai-camera-suite
cyberagentdevelopers
PRO
3
270
話題のGraphRAG、その可能性と課題を理解する
hide212131
4
1.5k
物価高なラスベガスでの過ごし方
zakky
0
380
バクラクにおける可観測性向上の取り組み
yuu26
3
420
現地でMeet Upをやる場合の注意点〜反省点を添えて〜
shotashiratori
0
520
Featured
See All Featured
Art, The Web, and Tiny UX
lynnandtonic
296
20k
It's Worth the Effort
3n
183
27k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
Building Better People: How to give real-time feedback that sticks.
wjessup
363
19k
Fashionably flexible responsive web design (full day workshop)
malarkey
404
65k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
664
120k
Happy Clients
brianwarren
97
6.7k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
32
1.8k
How to train your dragon (web standard)
notwaldorf
88
5.7k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Why You Should Never Use an ORM
jnunemaker
PRO
53
9k
Code Reviewing Like a Champion
maltzj
519
39k
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