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
140
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
87
Python-intro-1
liushuaikobe
0
87
GitRadar——毕业论文答辩
liushuaikobe
0
220
NoSQL & MongoDB
liushuaikobe
0
200
Other Decks in Technology
See All in Technology
【5分でわかる】セーフィー エンジニア向け会社紹介
safie_recruit
0
53k
Data Hubグループ 紹介資料
sansan33
PRO
0
3.1k
事業価値と Engineering 2026年度版
recruitengineers
PRO
30
16k
SnowflakeCoCoでデータエンジニアリング!
foursue
0
180
Cursor Meetup Sapporo - Cursor物語 続編
cocacola917
0
120
【CEDEC2026】次世代デジタルカードゲームのサーバー設計と運用 〜『Shadowverse: Worlds Beyond』の舞台裏~
cygames
PRO
0
850
MIRU 2026 チュートリアル
keisuke198619
0
810
PLaMo 3.0 Primeの事後学習
pfn
PRO
0
270
攻撃と防御で学ぶAI時代のプロダクトセキュリティ演習
recruitengineers
PRO
1
370
変化の早いClaude Codeを 書籍に落とし込む
oikon48
6
1.3k
【CEDEC2026】『GRANBLUE FANTASY: Relink - Endless Ragnarok』のバトル制作事例 ~最高のキャラゲーを目指して~
cygames
PRO
0
190
[ChatGPT Work LT]事務作業が苦手な人のための バックオフィスの「半」自動化
chimaki_iot
0
200
Featured
See All Featured
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
4.2k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.8k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.3k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
67
56k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
460
How Software Deployment tools have changed in the past 20 years
geshan
1
34k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.8k
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
160
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
230
Become a Pro
speakerdeck
PRO
31
6.1k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
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