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
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Shuai Liu
September 22, 2015
Technology
130
2
Share
Auto-Layout.pdf
Shuai Liu
September 22, 2015
More Decks by Shuai Liu
See All by Shuai Liu
Python-intro-2
liushuaikobe
0
82
Python-intro-1
liushuaikobe
0
79
GitRadar——毕业论文答辩
liushuaikobe
0
200
NoSQL & MongoDB
liushuaikobe
0
190
Other Decks in Technology
See All in Technology
ビジュアルプログラミングIoTLT vol.23
1ftseabass
PRO
0
150
Anthropic AIネイティブ・スタートアップ構築のプレイブック を理解する
nagatsu
0
210
基礎から解説!Icebergで紐解くSnowflake×Databricks連携の現在地
cm_yasuhara
0
380
Claude code Orchestra
ozakiomumkj
2
280
プラットフォームエンジニア ワークショップ/ platform-workshop
databricksjapan
0
120
A Harness for Behaviour: how to get AI to generate code that does what we intend, or "TDD in the age of AI"
xpmatteo
0
500
ルールやカスタム機能、どう使う?理想の出力を引き出すために今知りたいIBM Bob 5つの機能
muehara
0
120
大規模災害時でも高い信頼性を維持するアプリケーション基盤の実現/nikkei-tech-talk46
nikkei_engineer_recruiting
0
110
layerx-fde-practices
cipepser
6
2.9k
Fabric-cicd によるAzure DevOps デプロイ
ryomaru0825
0
120
Claude Codeですべての日常業務を爆速化しよう!
minorun365
PRO
16
15k
管理アカウント単一運用からAWS Organizationsに移行するの大変で滅
hiramax
0
300
Featured
See All Featured
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.2k
Site-Speed That Sticks
csswizardry
13
1.2k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
240
Game over? The fight for quality and originality in the time of robots
wayneb77
1
180
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
11k
Ethics towards AI in product and experience design
skipperchong
2
290
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
220
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.7k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
380
SEO for Brand Visibility & Recognition
aleyda
0
4.6k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Building Adaptive Systems
keathley
44
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