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
76
Python-intro-1
liushuaikobe
0
72
GitRadar——毕业论文答辩
liushuaikobe
0
180
NoSQL & MongoDB
liushuaikobe
0
160
Other Decks in Technology
See All in Technology
Oracle Database@Azure:サービス概要のご紹介
oracle4engineer
PRO
3
410
Proxmoxで作る自宅クラウド入門
koinunopochi
0
160
これまでのネットワーク運用を変えるかもしれないアプデをおさらい
hatahata021
4
230
歴史から学ぶ、Goのメモリ管理基礎
logica0419
14
2.9k
The Engineer with a Three-Year Cycle
e99h2121
0
160
GitHub Copilot CLI 現状確認会議
torumakabe
10
2.9k
旬のブリと旬の技術で楽しむ AI エージェント設計開発レシピ
chack411
1
290
Scrum Guide Expansion Pack が示す現代プロダクト開発への補完的視点
sonjin
0
790
サラリーマンソフトウェアエンジニアのキャリア
yuheinakasaka
42
19k
AWS Amplify Conference 2026 - 仕様からリリースまで一気通貫生成 AI 時代のフルスタック開発
inariku
2
290
ドメイン駆動セキュリティへの道しるべ
pandayumi
0
150
Introduction to Bill One Development Engineer
sansan33
PRO
0
350
Featured
See All Featured
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
5.1k
The Cult of Friendly URLs
andyhume
79
6.8k
Stop Working from a Prison Cell
hatefulcrawdad
273
21k
It's Worth the Effort
3n
188
29k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
390
Build The Right Thing And Hit Your Dates
maggiecrowley
38
3k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
359
30k
Color Theory Basics | Prateek | Gurzu
gurzu
0
180
Large-scale JavaScript Application Architecture
addyosmani
515
110k
The untapped power of vector embeddings
frankvandijk
1
1.5k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
170
A Modern Web Designer's Workflow
chriscoyier
698
190k
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