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
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
OpenID Connectによるサービス間連携
takesection
0
140
自称宇宙最速で不合格となったAIP-C01にリベンジを果たすべくAIで問題集アプリを作ってみた。
yama3133
0
230
AIガバナンス実践 - 生成AIコネクタのデータ漏洩リスクと実務対策
knishioka
0
130
Strands Agents超入門
kintotechdev
1
140
データ分析基盤の信頼を支える視点と設計
yuki_saito
2
760
大学生が本気でDatabricksを活用してDiscordサークルをデータ駆動させてみた
phantomjuju
1
270
JJUG CCC 2026 Spring AI時代の開発こそ標準化を武器に! ― 方式・プロセス・プラットフォームの標準化
s27watanabe
2
600
Spring AI × MCP 入門〜AIエージェントへのツール公開、境界設計から始める最小構成 〜
yuyamiyamoto
0
170
AI時代の私の技術インプットとアウトプット術
tonkotsuboy_com
15
7.6k
AI駆動開発でなんでもハンズオン環境をつくってみた
yoshimi0227
0
170
GitHub Copilot CLIでWebアクセシビリティを改善した話
tomokusaba
0
120
Spring Boot における AOT Cache 活用テクニックと 起動時間改善事例
ntt_dsol_java
0
170
Featured
See All Featured
The Pragmatic Product Professional
lauravandoore
37
7.3k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
199
74k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
270
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.2k
Leo the Paperboy
mayatellez
7
1.8k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
290
The browser strikes back
jonoalderson
0
1.1k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
230
Automating Front-end Workflow
addyosmani
1370
210k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
190
Exploring anti-patterns in Rails
aemeredith
3
380
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