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
85
Python-intro-1
liushuaikobe
0
83
GitRadar——毕业论文答辩
liushuaikobe
0
210
NoSQL & MongoDB
liushuaikobe
0
190
Other Decks in Technology
See All in Technology
LLMにもCAP定理があるという話
harukasakihara
0
380
AGENTS.mdとSkillsで始めるAIエージェント活用
sonoda_mj
3
220
2026TECHFRESH畢業分享會 - Lightning Talk - 打造精準高效的 MCP 設計模式與測試實務
line_developers_tw
PRO
0
1.1k
作って終わりにしない タイミーのセマンティックレイヤー育成の現在地
chanyou0311
4
2.4k
AIソロプレナー時代に2ヶ月で20人増員した事業創造会社の開発組織の話
miyatakoji
0
670
SONiCで構築・運用する生成AI向けパブリッククラウドネットワーク ~実装編~
sonic
0
230
小さく始める AI 活用推進 ― 日経電子版 Web チームの事例/nikkei-tech-talk47
nikkei_engineer_recruiting
0
270
脆弱性対応、どこで線を引くか
rymiyamoto
1
400
なぜ Platform Engineering の土台に Kubernetes を選ぶのか
r4ynode
2
650
Bedrock AgentCore RuntimeでAuth0 Changelog調査AIをアップグレードした話
t5u8a5a
1
160
Disciplined Vibes: Scaling AI-Assisted Engineering
sheharyar
0
150
気づかぬうちにセキュリティ負債を生むAPIキー運用
sgwrmctk
0
150
Featured
See All Featured
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
540
SEO for Brand Visibility & Recognition
aleyda
0
4.6k
[SF Ruby Conf 2025] Rails X
palkan
2
1.1k
Mobile First: as difficult as doing things right
swwweet
225
10k
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.7k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
65
56k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.5k
A Modern Web Designer's Workflow
chriscoyier
698
190k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
210
Utilizing Notion as your number one productivity tool
mfonobong
4
320
Code Reviewing Like a Champion
maltzj
528
40k
How STYLIGHT went responsive
nonsquared
100
6.2k
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