Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Auto-Layout.pdf
Search
Shuai Liu
September 22, 2015
Technology
150
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Auto-Layout.pdf
Shuai Liu
September 22, 2015
More Decks by Shuai Liu
See All by Shuai Liu
Python-intro-2
liushuaikobe
0
97
Python-intro-1
liushuaikobe
0
95
GitRadar——毕业论文答辩
liushuaikobe
0
260
NoSQL & MongoDB
liushuaikobe
0
220
Other Decks in Technology
See All in Technology
TinyGoでオブザーバビリティ?OpenTelemetryはTinyGoで使えるのか / Is OpenTelemetry available in TinyGo environment?
ymotongpoo
2
140
LambdaWebFunctionsを試してみた / exploring-lambda-web-functions
koukihosaka
1
340
『SAR衛星データ解析入門』のご紹介とその応用
syuchimu
0
120
「事実」を「計測」して、「解釈」する 〜AWS Lambdaのメモリ最適解の見つけ方〜
maimyyym
0
170
V8のArray.prototype.flatを最大約20倍速くするまでと、巨大OSSへの大規模コミットの道のり
riyaamemiya
0
290
Metadata - Section 1: HTML Basics
mohab1
0
120
分析AIエージェントを育てる、動く環境を育てる
codatum
1
1.1k
PagerDuty Tech Hub-鳴らすけれど、人は動かない
ezaki
0
170
hackers_champloo_2026_tidb
makocchi
0
160
夫婦で子育てするための育児標準化
codmoninc
PRO
0
330
オントロジーって 結局なにもの? AI エージェントに「意味」を渡す知識設計の話
greenmidori
0
190
Code for Security プロジェクト紹介 2026年10月
yu23ki14
0
110
Featured
See All Featured
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
2
6.3k
Exploring anti-patterns in Rails
aemeredith
4
540
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6.1k
Building Adaptive Systems
keathley
44
3.2k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Fireside Chat
paigeccino
43
4.1k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
12k
Odyssey Design
rkendrick25
PRO
2
870
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
850
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
630
Scaling GitHub
holman
464
140k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.2k
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