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
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
95
Python-intro-1
liushuaikobe
0
90
GitRadar——毕业论文答辩
liushuaikobe
0
230
NoSQL & MongoDB
liushuaikobe
0
200
Other Decks in Technology
See All in Technology
絵ではじめるKubernetesセキュリティ
aoi1
3
500
越境するなら専門用語を使うな高校校歌 / If you wanna cross border, you shouldn't use jargon
vtryo
0
130
Deploying a Full-Stack Bun-Native Framework on Cloudflare Workers
7nohe
0
160
DEFCON_CHV_CTF_Write-up.pdf
bata_24
0
150
What the customer really needed
kawaguti
PRO
1
150
LTのテーマ どうきめてる?〜5つの型と私のやり方〜
yama3133
1
100
Slack上でインフラをトラブルシュートする! Agentic Platform Engineeringの第一歩
teru0x1
4
1.6k
顧客に向き合う開発組織へ。リアーキテクチャとフィーチャーチーム化で挑む組織改革
safie
0
1.5k
データ_AIの事業の勝敗をわけるもの
nek0128
0
310
目の前の楽しいが人生を変える - コミュニティの螺旋の歩き方と楽しむコツ / change your life
soudai
PRO
4
570
例外の正しい扱い方 そのエラー try-catchして大丈夫?
jinwatanabe
3
500
作品が生態系になった ─ Mini Tokyo 3D から世界へ
nagix
0
180
Featured
See All Featured
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
570
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
320
Writing Fast Ruby
sferik
630
63k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
830
How to make the Groovebox
asonas
2
2.4k
What's in a price? How to price your products and services
michaelherold
247
13k
Embracing the Ebb and Flow
colly
88
5.2k
Build your cross-platform service in a week with App Engine
jlugia
234
19k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
450
Evolving SEO for Evolving Search Engines
ryanjones
0
290
The SEO identity crisis: Don't let AI make you average
varn
0
560
Reality Check: Gamification 10 Years Later
codingconduct
0
2.3k
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