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
550
Apple公式ガイドさっくりまとめ ファイルシステム編
utwang
0
35
頻出pryコマンド
utwang
0
120
設計ポイントの 比較で知る Backbone.js
utwang
9
6.9k
Other Decks in Programming
See All in Programming
What’s New in Compose Multiplatform - A Live Tour (droidcon London 2024)
zsmb
1
480
A Journey of Contribution and Collaboration in Open Source
ivargrimstad
0
1k
Realtime API 入門
riofujimon
0
150
CSC509 Lecture 13
javiergs
PRO
0
110
Amazon Bedrock Agentsを用いてアプリ開発してみた!
har1101
0
340
よくできたテンプレート言語として TypeScript + JSX を利用する試み / Using TypeScript + JSX outside of Web Frontend #TSKaigiKansai
izumin5210
6
1.8k
距離関数を極める! / SESSIONS 2024
gam0022
0
290
ActiveSupport::Notifications supporting instrumentation of Rails apps with OpenTelemetry
ymtdzzz
1
250
Ethereum_.pdf
nekomatu
0
470
ローコードSaaSのUXを向上させるためのTypeScript
taro28
1
630
みんなでプロポーザルを書いてみた
yuriko1211
0
280
ヤプリ新卒SREの オンボーディング
masaki12
0
130
Featured
See All Featured
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
26
2.1k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
[RailsConf 2023] Rails as a piece of cake
palkan
52
4.9k
Into the Great Unknown - MozCon
thekraken
32
1.5k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
Documentation Writing (for coders)
carmenintech
65
4.4k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.2k
The Cost Of JavaScript in 2023
addyosmani
45
6.8k
How to Think Like a Performance Engineer
csswizardry
20
1.1k
The Pragmatic Product Professional
lauravandoore
31
6.3k
Statistics for Hackers
jakevdp
796
220k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
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