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
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
80
Python-intro-1
liushuaikobe
0
74
GitRadar——毕业论文答辩
liushuaikobe
0
190
NoSQL & MongoDB
liushuaikobe
0
180
Other Decks in Technology
See All in Technology
20260415_生成AIを専属DSに_自動レポート作成_ハンズオン_交通事故データ
doradora09
PRO
0
110
申請待ちゼロへ!AWS × Entra IDで実現した「権限付与」のセルフサービス化
mhrtech
2
330
猫でもわかるKiro CLI(CDKコーディング編)
kentapapa
1
120
Amazon S3 Filesについて
yama3133
2
180
AIペネトレーションテスト・ セキュリティ検証「AgenticSec」ご紹介資料
laysakura
0
3.8k
CloudSec JP #005 後締め ~ソフトウェアサプライチェーン攻撃から開発者のシークレットを守る~
lhazy
0
220
みんなの「データ活用」を支えるストレージ担当から持ち込むAWS活用/コミュニティー設計TIPS 10選~「作れる」より、「続けられる」設計へ~
yoshiki0705
0
210
Rapid Start: Faster Internet Connections, with Ruby's Help
kazuho
2
140
AI駆動1on1〜AIに自分を育ててもらう〜
yoshiakiyasuda
0
110
Sansan Engineering Unit 紹介資料
sansan33
PRO
1
4.2k
#jawsugyokohama 100 LT11, "My AWS Journey 2011-2026 - kwntravel"
shinichirokawano
0
310
名刺メーカーDevグループ 紹介資料
sansan33
PRO
0
1.1k
Featured
See All Featured
Designing for Timeless Needs
cassininazir
0
190
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.2k
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
98
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
520
The Cult of Friendly URLs
andyhume
79
6.8k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
120
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
1k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.1k
Paper Plane (Part 1)
katiecoart
PRO
0
6.6k
Agile that works and the tools we love
rasmusluckow
331
21k
Balancing Empowerment & Direction
lara
6
1k
Faster Mobile Websites
deanohume
310
31k
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