Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Auto-Layout.pdf
Search
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
73
Python-intro-1
liushuaikobe
0
71
GitRadar——毕业论文答辩
liushuaikobe
0
180
NoSQL & MongoDB
liushuaikobe
0
150
Other Decks in Technology
See All in Technology
AWSセキュリティアップデートとAWSを育てる話
cmusudakeisuke
0
220
年間40件以上の登壇を続けて見えた「本当の発信力」/ 20251213 Masaki Okuda
shift_evolve
PRO
1
100
MLflowで始めるプロンプト管理、評価、最適化
databricksjapan
1
140
AWS CLIの新しい認証情報設定方法aws loginコマンドの実態
wkm2
6
700
Uncertainty in the LLM era - Science, more than scale
gaelvaroquaux
0
840
コミューンのデータ分析AIエージェント「Community Sage」の紹介
fufufukakaka
0
470
Edge AI Performance on Zephyr Pico vs. Pico 2
iotengineer22
0
130
AWS Bedrock AgentCoreで作る 1on1支援AIエージェント 〜Memory × Evaluationsによる実践開発〜
yusukeshimizu
6
380
Snowflakeでデータ基盤を もう一度作り直すなら / rebuilding-data-platform-with-snowflake
pei0804
4
1.3k
日本Rubyの会の構造と実行とあと何か / hokurikurk01
takahashim
4
1k
「Managed Instances」と「durable functions」で広がるAWS Lambdaのユースケース
lamaglama39
0
300
AI駆動開発における設計思想 認知負荷を下げるフロントエンドアーキテクチャ/ 20251211 Teppei Hanai
shift_evolve
PRO
2
340
Featured
See All Featured
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
132
19k
KATA
mclloyd
PRO
32
15k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.8k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.3k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.3k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Automating Front-end Workflow
addyosmani
1371
200k
Embracing the Ebb and Flow
colly
88
4.9k
The Language of Interfaces
destraynor
162
25k
For a Future-Friendly Web
brad_frost
180
10k
The Cult of Friendly URLs
andyhume
79
6.7k
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