Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
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
74
Python-intro-1
liushuaikobe
0
71
GitRadar——毕业论文答辩
liushuaikobe
0
180
NoSQL & MongoDB
liushuaikobe
0
160
Other Decks in Technology
See All in Technology
ディメンショナルモデリングを支えるData Vaultについて
10xinc
1
100
Databricks向けJupyter Kernelでデータサイエンティストの開発環境をAI-Readyにする / Data+AI World Tour Tokyo After Party
genda
1
520
生成AIを利用するだけでなく、投資できる組織へ / Becoming an Organization That Invests in GenAI
kaminashi
0
100
初めてのDatabricks AI/BI Genie
taka_aki
0
200
Jakarta Agentic AI Specification - Status and Future
reza_rahman
0
110
.NET 10の概要
tomokusaba
0
110
ChatGPTで論⽂は読めるのか
spatial_ai_network
10
29k
年間40件以上の登壇を続けて見えた「本当の発信力」/ 20251213 Masaki Okuda
shift_evolve
PRO
1
140
【U/day Tokyo 2025】Cygames流 最新スマートフォンゲームの技術設計 〜『Shadowverse: Worlds Beyond』におけるアーキテクチャ再設計の挑戦~
cygames
PRO
2
390
JEDAI認定プログラム JEDAI Order 2026 エントリーのご案内 / JEDAI Order 2026 Entry
databricksjapan
0
130
IAMユーザーゼロの運用は果たして可能なのか
yama3133
1
460
Challenging Hardware Contests with Zephyr and Lessons Learned
iotengineer22
0
230
Featured
See All Featured
For a Future-Friendly Web
brad_frost
180
10k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.2k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.5k
How STYLIGHT went responsive
nonsquared
100
6k
BBQ
matthewcrist
89
9.9k
Reflections from 52 weeks, 52 projects
jeffersonlam
355
21k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.2k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Visualization
eitanlees
150
16k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
8.3k
GraphQLとの向き合い方2022年版
quramy
50
14k
We Have a Design System, Now What?
morganepeng
54
7.9k
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