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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
170
Other Decks in Technology
See All in Technology
Oracle Cloud Observability and Management Platform - OCI 運用監視サービス概要 -
oracle4engineer
PRO
2
14k
学生・新卒・ジュニアから目指すSRE
hiroyaonoe
2
560
SREが向き合う大規模リアーキテクチャ 〜信頼性とアジリティの両立〜
zepprix
0
400
What happened to RubyGems and what can we learn?
mikemcquaid
0
250
顧客との商談議事録をみんなで読んで顧客解像度を上げよう
shibayu36
0
170
GitHub Issue Templates + Coding Agentで簡単みんなでIaC/Easy IaC for Everyone with GitHub Issue Templates + Coding Agent
aeonpeople
1
180
Amazon S3 Vectorsを使って資格勉強用AIエージェントを構築してみた
usanchuu
3
440
(金融庁共催)第4回金融データ活用チャレンジ勉強会資料
takumimukaiyama
0
130
Tebiki Engineering Team Deck
tebiki
0
24k
GitLab Duo Agent Platform × AGENTS.md で実現するSpec-Driven Development / GitLab Duo Agent Platform × AGENTS.md
n11sh1
0
120
Context Engineeringが企業で不可欠になる理由
hirosatogamo
PRO
3
410
SREのプラクティスを用いた3領域同時 マネジメントへの挑戦 〜SRE・情シス・セキュリティを統合した チーム運営術〜
coconala_engineer
2
600
Featured
See All Featured
Utilizing Notion as your number one productivity tool
mfonobong
2
210
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
130
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
0
140
Faster Mobile Websites
deanohume
310
31k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
160
Building a Scalable Design System with Sketch
lauravandoore
463
34k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.3k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
440
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
1
97
The Spectacular Lies of Maps
axbom
PRO
1
520
GitHub's CSS Performance
jonrohan
1032
470k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
910
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