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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
79
Python-intro-1
liushuaikobe
0
74
GitRadar——毕业论文答辩
liushuaikobe
0
180
NoSQL & MongoDB
liushuaikobe
0
170
Other Decks in Technology
See All in Technology
Security Diaries of an Open Source IAM
ahus1
0
190
問い合わせ自動化の技術的挑戦
recruitengineers
PRO
2
130
トラブルの大半は「言ってない」x「言ってない」じゃねーか!!
ichimichi
0
300
【5分でわかる】セーフィー エンジニア向け会社紹介
safie_recruit
0
44k
Introduction to Bill One Development Engineer
sansan33
PRO
0
380
生成AI活用によるPRレビュー改善の歩み
lycorptech_jp
PRO
5
2k
Kaggleの経験が実務にどう活きているか / kaggle_findy
sansan_randd
3
370
primeNumber DATA MANAGEMENT CAMP #2:
masatoshi0205
1
680
Datadog Cloud Cost Management で実現するFinOps
taiponrock
PRO
0
130
「使いにくい」も「運用疲れ」も卒業する UIデザイナーとエンジニアが創る持続可能な内製開発
nrinetcom
PRO
1
770
LLM活用の壁を超える:リクルートR&Dの戦略と打ち手
recruitengineers
PRO
1
220
What's new in Go 1.26?
ciarana
2
280
Featured
See All Featured
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.3k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
280
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
98
Making Projects Easy
brettharned
120
6.6k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
230
Balancing Empowerment & Direction
lara
5
930
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.6k
Prompt Engineering for Job Search
mfonobong
0
180
Design in an AI World
tapps
0
160
Art, The Web, and Tiny UX
lynnandtonic
304
21k
Color Theory Basics | Prateek | Gurzu
gurzu
0
220
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
130
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