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
73
Python-intro-1
liushuaikobe
0
69
GitRadar——毕业论文答辩
liushuaikobe
0
180
NoSQL & MongoDB
liushuaikobe
0
150
Other Decks in Technology
See All in Technology
DDD x Microservice Architecture : Findy Architecture Conf 2025
syobochim
12
3.3k
How We Built a Secure Sandbox Platform for AI
flatt_security
1
110
TypeScript 6.0で非推奨化されるオプションたち
uhyo
13
4.1k
国産クラウドを支える設計とチームの変遷 “技術・組織・ミッション”
kazeburo
4
6.5k
身近なCSVを活用する!AWSのデータ分析基盤アーキテクチャ
koosun
0
3.6k
グローバルなコンパウンド戦略を支えるモジュラーモノリスとドメイン駆動設計
kawauso
3
6.6k
ZOZOTOWNカート決済リプレイス ── モジュラモノリスという過渡期戦略
zozotech
PRO
0
500
AI時代の戦略的アーキテクチャ 〜Adaptable AI をアーキテクチャで実現する〜 / Enabling Adaptable AI Through Strategic Architecture
bitkey
PRO
14
7.9k
pmconf 2025 大阪「生成AI時代に未来を切り開くためのプロダクト戦略:圧倒的生産性を実現するためのプロダクトサイクロン」 / The Product Cyclone for Outstanding Productivity
yamamuteki
3
2k
AIと自動化がもたらす業務効率化の実例: 反社チェック等の調査・業務プロセス自動化
enpipi
0
760
その意思決定、まだ続けるんですか? ~痛みを超えて未来を作る、AI時代の撤退とピボットの技術~
applism118
34
21k
FFMとJVMの実装から学ぶJavaのインテグリティ
kazumura
0
160
Featured
See All Featured
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.3k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
Optimising Largest Contentful Paint
csswizardry
37
3.5k
GraphQLとの向き合い方2022年版
quramy
49
14k
The Cult of Friendly URLs
andyhume
79
6.7k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Faster Mobile Websites
deanohume
310
31k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.8k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
132
19k
Being A Developer After 40
akosma
91
590k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
15k
Code Reviewing Like a Champion
maltzj
527
40k
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