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
75
Python-intro-1
liushuaikobe
0
72
GitRadar——毕业论文答辩
liushuaikobe
0
180
NoSQL & MongoDB
liushuaikobe
0
160
Other Decks in Technology
See All in Technology
AI駆動開発ライフサイクル(AI-DLC)の始め方
ryansbcho79
0
200
松尾研LLM講座2025 応用編Day3「軽量化」 講義資料
aratako
11
4.4k
マイクロサービスへの5年間 ぶっちゃけ何をしてどうなったか
joker1007
21
8.3k
ESXi のAIOps だ!2025冬
unnowataru
0
390
SQLだけでマイグレーションしたい!
makki_d
0
1.2k
業務の煩悩を祓うAI活用術108選 / AI 108 Usages
smartbank
9
14k
AgentCore BrowserとClaude Codeスキルを活用した 『初手AI』を実現する業務自動化AIエージェント基盤
ruzia
7
1.7k
AI時代のワークフロー設計〜Durable Functions / Step Functions / Strands Agents を添えて〜
yakumo
3
2.3k
202512_AIoT.pdf
iotcomjpadmin
0
150
20251219 OpenIDファウンデーション・ジャパン紹介 / OpenID Foundation Japan Intro
oidfj
0
520
意外と知らない状態遷移テストの世界
nihonbuson
PRO
1
280
Microsoft Agent Frameworkの可観測性
tomokusaba
1
120
Featured
See All Featured
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
0
1.8k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
4 Signs Your Business is Dying
shpigford
187
22k
Mind Mapping
helmedeiros
PRO
0
40
My Coaching Mixtape
mlcsv
0
14
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
150
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
9.1k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
94
The untapped power of vector embeddings
frankvandijk
1
1.5k
Are puppies a ranking factor?
jonoalderson
0
2.5k
jQuery: Nuts, Bolts and Bling
dougneiner
65
8.3k
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