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
Apple公式ガイドを さっくりと読んでまとめてみた UIScrollView編
Search
Atsushi Uchida (utwang)
October 08, 2015
Programming
0
220
Apple公式ガイドを さっくりと読んでまとめてみた UIScrollView編
UIScrollViewとAutolayoutを併用するときのわかりにくかったところのまとめ
Atsushi Uchida (utwang)
October 08, 2015
Tweet
Share
More Decks by Atsushi Uchida (utwang)
See All by Atsushi Uchida (utwang)
Measurement And Unitを試した話
utwang
0
560
Apple公式ガイドさっくりまとめ ファイルシステム編
utwang
0
37
頻出pryコマンド
utwang
0
120
設計ポイントの 比較で知る Backbone.js
utwang
9
7k
Other Decks in Programming
See All in Programming
Zoneless Testing
rainerhahnekamp
0
120
StarlingMonkeyを触ってみた話 - 2024冬
syumai
3
270
Effective Signals in Angular 19+: Rules and Helpers @ngbe2024
manfredsteyer
PRO
0
140
Spatial Rendering for Apple Vision Pro
warrenm
0
110
Symfony Mapper Component
soyuka
2
730
rails statsで大解剖 🔍 “B/43流” のRailsの育て方を歴史とともに振り返ります
shoheimitani
2
930
SymfonyCon Vienna 2025: Twig, still relevant in 2025?
fabpot
3
1.2k
HTTP compression in PHP and Symfony apps
dunglas
2
1.7k
PHPUnitしか使ってこなかった 一般PHPerがPestに乗り換えた実録
mashirou1234
0
190
KubeCon + CloudNativeCon NA 2024 Overviewat Kubernetes Meetup Tokyo #68 / amsy810_k8sjp68
masayaaoyama
0
250
モバイルアプリにおける自動テストの導入戦略
ostk0069
0
110
【re:Growth 2024】 Aurora DSQL をちゃんと話します!
maroon1st
0
780
Featured
See All Featured
A Philosophy of Restraint
colly
203
16k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
Designing for Performance
lara
604
68k
Agile that works and the tools we love
rasmusluckow
328
21k
Become a Pro
speakerdeck
PRO
26
5k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
29
2k
Documentation Writing (for coders)
carmenintech
66
4.5k
Writing Fast Ruby
sferik
628
61k
How GitHub (no longer) Works
holman
311
140k
Optimising Largest Contentful Paint
csswizardry
33
3k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Transcript
͍·͞ΒAppleެࣜΨΠυΛ ͬ͘͞ΓͱಡΜͰ·ͱΊͯΈͨ ʙ iOS ScrollViewϓϩάϥϛϯάΨΠυฤ ʙ 2015/10/08
͜ͷΨΠυͷओͳ༰ • ScrollViewͷ࡞ͱઃఆ • εΫϩʔϧͷΠϕϯτͱ੍ޚ(delegateϝοηʔδ) • ϐϯνδΣενϟΛͬͨζʔϜ • λοϓͰͷζʔϜ •
ϖʔδϯάϞʔυʹ͍ͭͯ
͜ͷࢿྉͷ༰ • εΫϩʔϧͷઃఆ • ϐϯνΠϯɺϐϯνΞτͷઃఆ • ϋϚͬͨͱ͜Ζ(AutoLayout)
جຊػೳͱߏ • ػೳ • ը໘ʹೖΓ͖Βͳ͍ίϯςϯ πͷεΫϩʔϧ • ίϯςϯπͷ֦େ/ॖখ • Viewͷߏ
UIScrollView ᵋ ίϯςϯπͱͳΔsubview ɹɹɹ(͜͜ͰUIImageView)
εΫϩʔϧ • Scroll͢ΔͨΊʹߦ͏ઃఆ • contentSizeϓϩύςΟΛࢦఆ • subviewʹίϯςϯπͱͳΔ ViewΛՃ ੨ɿwindowαΠζ, scrollView.bounds
ɿscrollView.contentSize ബɿsubView.bounds
ϐϯνΠϯ/ϐϯνΞτ • ϐϯνΠϯ/ϐϯνΞτ͢ΔͨΊʹߦ͏ ઃఆ • ViewControllerΛUIScrollViewDelegate ʹద߹ • viewForZoomingInScrollViewͰζʔ Ϝ͍ͨ͠viewΛฦ͢
• ζʔϜͷഒΛࢦఆ • minimumZoomScale • maximumZoomScale ੨ɿscrollView.bounds,scrollView.contentSize ബɿsubView.bounds
UIScrollViewͰϋϚͬͨͱ͜Ζ • AutoLayoutͱUIScrollViewͷҰॹʹ͏ͱ͖ • εΫϩʔϧ͠ͳ͔ͬͨΓɺίϯςϯπ͕දࣔ͞Εͳ͔ͬ ͨΓઃఆʹ͔͔࣌ؒͬͨ • ͕ղফͰ͖ͨͱ͖ʹԿ͕ͩͬͨͷ͔Α͘Θ͔ Βͳ͔ͬͨ
εΫϩʔϧྖҬͷܾΊํ ίʔυͷ߹ • scrollViewͷϓϩύςΟ ͷcontentSizeΛࢦఆ͢Δ ʢϚϧνσόΠεʹରԠ ͢Δͱ͖ࡶʣ DPOUFOU4J[F TDSPMM7JFX
"' (&" &%!" #$
εΫϩʔϧྖҬͷܾΊํ Autolayoutͷ߹ • contentSizeͷେ͖͞ Autolayout͕ࣗಈͰࢉग़ • subviewͷ෯/ߴ͞ɺ੍ Ͱܾఆ͞ΕΔ ͕͜͜ҙʂ subviewͷ෯ͱߴ͕͞શʹܾ
·ΔΑ͏ʹ੍Λࢦఆ͢Δඞཁ͋Γʂ 6*7JFX 4DSPMM7JFXͷTVCWJFX TDSPMM7JFX ϥϕϧͳͲͷ7JFX
Θ͔Γʹ͍͘ཧ༝ • AutolayoutͰ1ͭͷ viewͷҐஔɺେ͖͞Λผ ͷviewͱͷ૬ରͰܾΊΔ • ීஈ্ҐͷView()͔ Β੍ΛܾΊ͍ͯ͘Ξϓ ϩʔν͢Δ͜ͱ͕ଟ͍ʢ ͣʣ
6*7JFX ϥϕϧͳͲͷ7JFX
Θ͔Γʹ͍͘ཧ༝ • UIScrollViewΛ AutolayoutͰར༻͢Δ ߹ɺԼҐͷViewͷ੍Λ ઃఆͯ͠ɺεΫϩʔϧྖ ҬͱͳΔViewͷେ͖͞Λ ܾΊΔΞϓϩʔνͱͳΔ • ٯ͖ͷΞϓϩʔνͳͷ
ͰΘ͔Γʹ͍͘ 6*7JFX ϥϕϧͳͲͷ7JFX