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
Swiftで作るiOSアプリ開発入門_06
Search
jollyjoester
March 12, 2016
Education
0
93
Swiftで作るiOSアプリ開発入門_06
Schoo講義資料
jollyjoester
March 12, 2016
Tweet
Share
More Decks by jollyjoester
See All by jollyjoester
コミュニティMTG in WWDC24
jollyjoester
0
250
BengaluruでLTしてきた
jollyjoester
0
290
try! Swift Tokyo 2024
jollyjoester
0
270
エンジニアが直接会う場の価値について
jollyjoester
8
4.1k
来年Proposalを出すつもりで参加するときっともっと楽しい!
jollyjoester
0
310
My favorite sessions in WWDC 23
jollyjoester
0
590
みんなでAIと戯れよう
jollyjoester
0
120
続く勉強会の作り方
jollyjoester
2
820
Code for INZAIの歩み
jollyjoester
0
410
Other Decks in Education
See All in Education
Unraveling JavaScript Prototypes
debug_mode
0
140
Ch4_-_Cours_2.pdf
bernhardsvt
0
130
地図を活用した関西シビックテック事例紹介
barsaka2
0
170
Mathematics used in cryptography around us
herumi
2
740
XML and Related Technologies - Lecture 7 - Web Technologies (1019888BNR)
signer
PRO
0
2.6k
Use Cases and Course Review - Lecture 8 - Human-Computer Interaction (1023841ANR)
signer
PRO
0
870
開発終了後こそ成長のチャンス!プロダクト運用を見送った先のアクションプラン
ohmori_yusuke
2
290
TP5_-_UV.pdf
bernhardsvt
0
140
HCL Notes/Domino 14.5 EAP Drop1
harunakano
1
150
書を持って、自転車で町へ出よう
yuritaco
0
140
Da Necessidade da Devoção à Virgem Santíssima
cm_manaus
0
120
Flinga
matleenalaakso
2
14k
Featured
See All Featured
Faster Mobile Websites
deanohume
306
31k
Designing Experiences People Love
moore
139
23k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
StorybookのUI Testing Handbookを読んだ
zakiyama
28
5.5k
It's Worth the Effort
3n
184
28k
Building Applications with DynamoDB
mza
93
6.2k
KATA
mclloyd
29
14k
Embracing the Ebb and Flow
colly
84
4.6k
Building Flexible Design Systems
yeseniaperezcruz
328
38k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Side Projects
sachag
452
42k
VelocityConf: Rendering Performance Case Studies
addyosmani
328
24k
Transcript
SwiftͰ࡞Δ iOSΞϓϦ։ൃೖ 6ݶɿΞϓϦͷݟͨΛߏ͢ΔViewͷཧղ 1
ࣗݾհ ࣣౡҒ೭ʢͳͳ͠·ͻͰΏ͖ʣ Reproגࣜձࣾ iPhoneΞϓϦ։ൃ͕͖ 2
ࣗݾհ 3 https://repro.io
ຊίʔεͷඪ ۤΛΓӽ͑ͯ ָ͘͠ΞϓϦ։ൃͰ͖ΔΑ͏ʹͳΔʂ 4
෭ڭࡐ վగ൛ No.1εΫʔϧߨࢣਞʹΑΔ ੈքҰड͚͍ͨ iPhoneΞϓϦ։ൃͷतۀ (ٕज़ධࣾ) 5
ࠓճͷतۀͷඪ ViewΛֶΜͰࣗͷࢥ͍ඳ͘ ΞϓϦͷݟͨΛ࡞ΕΔΑ͏ʹ͢Δ 6
तۀͷલఏ݅ • ͓खݩͷMacʹXcode(version7.0Ҏ্)͕Πϯετʔ ϧ͞Ε͍ͯΔ͜ͱ • લճͷ͍ΞϓϦϓϩδΣΫτ͕͋ΔͱΑΓ༗ޮʹ ֶशͰ͖·͢ɻϓϩδΣΫτԼه͔Βμϯϩʔ υͰ͖·͢ɻ https://github.com/jollyjoester/Schoo-iOS-App- Development-Basic/archive/05.zip
7
ຊͷϝχϡʔ • ViewͱԿ͔ΛֶͿ • ViewͷߏΛֶͿ • ΞχϝʔγϣϯͰಈ͖ΛՃ͑Δ 8
ͦͷલʹલճͷ࣭͝ ʢ؆୯ͳ͍ΞϓϦͷاը͔Β։ൃ·ͰΛମݧʣ • teratailͰ࣭͢Δͷ༗ྉձһͱ͔ʹͳΔඞཁ͕͋Δͷ ͔ͳɻ from Kenichi Gotoh͞Μ ‣ ແྉͰ͢ʂ
https://teratail.com/ 9
ͦͷલʹલճͷ࣭͝ ʢ؆୯ͳ͍ΞϓϦͷاը͔Β։ൃ·ͰΛମݧʣ • ΞϚκϯͰߪೖ͠Α͏ͱࢥ͍ɺઌੜͷຊΛݕࡧͨ͠ͱ͜ΖɺϨ Ϗϡʔʹʮಛʹ8ষͰΘΕΔJSONσʔλΛղੳ͢Δπʔϧ ͕ɺ࣮ػςετͰக໋తͳΤϥʔΛు͖·͢ɻษڧʹͳΓ ·͕͢ɺApp StoreͰͷϦϦʔεΛࢦ͢ํɺຊॻΛߪೖ͠ ͳ͍΄͏͕ྑ͍Ͱ͠ΐ͏ɻʯͱͳ͍ͬͯͯߪೖΛ᪳ͯ͠͠· ͍·ͨ͠ɻ͜ͷղܾ͞Ε͍ͯΔͷͰ͠ΐ͏͔ʁ
from ϛϢ͞Μ ‣ ͓Βͤ͋Γ͕ͱ͏͍͟͝·͢ʂϥΠϒϥϦͷಋೖखॱʹ ෆ͕͋Γ·ͨ͠ɻ࣍ͷઃఆΛ͢Ε࣮ػͰ࣮ߦͰ͖· ͢ɻʢαϙʔταΠτͷܝࡌग़൛ࣾʹ͓ئ͍ͯ͠Έ·͢ʣ 10
ͦͷલʹલճͷ࣭͝ ʢ؆୯ͳ͍ΞϓϦͷاը͔Β։ൃ·ͰΛମݧʣ 11
ͦͷલʹલճͷ࣭͝ ʢ؆୯ͳ͍ΞϓϦͷاը͔Β։ൃ·ͰΛମݧʣ 12
ͦͷલʹલճͷ࣭͝ ʢ؆୯ͳ͍ΞϓϦͷاը͔Β։ൃ·ͰΛମݧʣ 13 • ॎɾԣ ผʑͷϨΠΞτͬͯ ग़དྷͳ͍ͷ͔ͳʁ from dig sum͞Μ
‣ SizeClassesΛͬͯͰ͖·͢ʂ
Έͳ͞·࣭͋Γ·ͨ͠Βͥͻ࣭͍ͩ͘͝͞ɻ तۀதʹऔΓ্͛ΒΕͳͯ͘ ग़དྷΔݶΓ͓͑͠·͢ʂ ͳΔ΄ͲʂͱࢥͬͨΒʮͳΔ΄ͲʯϘλϯΛ ԡ͍͚ͯͨͩ͠ΔͱྭΈʹͳΓ·͢(`ŋωŋ´) 14
ViewͱԿ͔ΛֶͿ 15
Viewͱ • ը໘Λදࣔ͢ΔͨΊͷͷ • UILabel, UIButtonͳͲ • λοϓͳͲͷΞΫγϣϯΛड͚औΔׂ 16
Viewͷछྨ ʢԿ͔Λදࣔ͢ΔͨΊͷViewʣ 17 ໊લ Ϋϥε໊ ׂ Ϗϡʔ UIView ͬͱجຊͷ෦ ϥϕϧ
UILabel จࣈΛදࣔ͢Δ ςΩετϏϡʔ UITextView จࣈͷදࣔͱฤूΛ͢Δ ΠϝʔδϏϡʔ UIImageView ը૾Λදࣔ͢Δ ϐοΧʔϏϡʔ UIPickerView બࢶͷදࣔͱબΛ͢Δ ΣϒϏϡʔ UIWebView ΣϒϖʔδΛදࣔ͢Δ
Viewͷछྨ ʢϢʔβʔ͔ΒͷΞΫγϣϯΛड͚औΔͷViewʣ 18 ໊લ Ϋϥε໊ ׂ Ϙλϯ UIButton Ϙλϯ ςΩετϑΟʔϧυ
UITextField จࣈΛೖྗ͢Δ εΠον UISwitch ΦϯͱΦϑΛ͢ΔεΠον ηάϝϯςου ίϯτϩʔϧ UISegmented Control ηάϝϯτΛબ͢Δ εςούʔ UIStepper Λ૿ͨ͠ΓݮΒͨ͠Γ͢Δ εϥΠμʔ UISlider εϥΠμʔͰΛબ
ʢ༨ஊʣUIxxxͬͯʁ • AppleͷframeworkͷΫϥε໊ʢ෦ʣʹ prefix͕͍͍ͭͯΔ ‣ CoreLocation -> CLLocationManager ‣ AVFoundation
-> AVCaptureDeviceInput ‣ UIKit -> UILabel, UIButton 19
ɹUIView • ࢛͍֯ྖҬΛද͢࠷جຊతͳView • ViewͷதʹViewΛؚΉ͜ͱ͕Ͱ͖Δ ʢContainerͱ͔ݴͬͨΓ͢Δʣ • ؚΉํͷViewSuper View ؚ·ΕΔํSub
Viewͱ͍͏ 20
ɹUIView 21
ɹUIView 22
ɹUIView 23
ɹUILabel 24 • จࣈΛදࣔ͢ΔͨΊͷView
ɹUILabel 25
UIImageView 26 • ը૾Λදࣔ͢ΔͨΊͷView
UIImageView 27
ɹUIButton 28 • ϘλϯʢλοϓΛݕ͢Δʣ
ɹUIButton 29
ɹUITextView 30
UIPickerView 31
UITextField 32
UISwitch 33 UISegmented Control UIStepper UISlider
ViewͷߏΛΔ 34
ViewͷߏΛΔ ViewͷதʹViewΛஔͯ͠ ͞ΒʹLabelΛஔͯ͠ΈΔ 35
ViewͷߏΛΔ ʢDebug View Hierarchyʣ 36
ViewͷߏΛΔ ʢDebug View Hierarchyʣ 37
ViewͷߏΛΔ ʢDocument Outlineʣ 38
ViewͷߏΛΔ ʢDocument Outlineʣ 39
ViewͷߏΛΔ ʢDocument Outlineʣ 40
ViewͷߏΛΔ ʢDocument Outlineʣ 41
ViewͷߏΛΔ ʢDocument Outlineʣ 42
ViewͷߏΛΔ ʢDocument Outlineʣ 43
ViewͷߏΛΔ ʢDocument Outlineʣ 44
ΞχϝʔγϣϯͰಈ͖ΛՃ͑Δ 45
Ξχϝʔγϣϯ ʢ·࣮ͣફ͔Βʣ • AnimalFortuneTellingϓϩδΣΫτΛ։͘ https://github.com/jollyjoester/Schoo-iOS- App-Development-Basic/archive/05.zip • ViewController.swiftΛબ 46
Ξχϝʔγϣϯ ʢϩδοΫΛϝιουʹΓग़͠ʣ 47
Ξχϝʔγϣϯ ʢanimateWithDurationʣ 48 • ·ͣԼهͷ௨Γॻ͍࣮ͯߦͯ͠ΈΔ ͍͠จ๏͕ΘΕ͍ͯΔͷͰ ·ͣߟ͑ͣʹ͓֮͑ͯ͏ʂ
Ξχϝʔγϣϯ ʢdurationʣ 49 • Ͳͷ͘Β͍ͷ࣌ؒΛ͔͚ͯΞχϝʔγϣϯΛ͢Δ͔ 1.0ඵ͔͚ؒͯΞχϝʔγϣϯΛߦ͏
Ξχϝʔγϣϯ ʢanimationsʣ 50 • Ξχϝʔγϣϯͷ݁ՌͲͷΑ͏ʹͳΔ͔ animalLabelΛ0.2ഒͷେ͖͞ʹ͢Δ
Ξχϝʔγϣϯ ʢcompletionʣ 51 • Ξχϝʔγϣϯ͕ऴΘͬͨޙʹ͢Δॲཧ ݩʹͯ͠changeLabelϝιουΛ࣮ߦ͢Δ
Ξχϝʔγϣϯ ʢresultLabelʣ 52 ΞχϝʔγϣϯதresultLabelফ͢ ݁Ռ͕ग़ͨΒදࣔ͢Δ
Ξχϝʔγϣϯ ʢanimalLabelʣ 53 animalLabelΛͩΜͩΜಁ໌ʹ͢Δ
54 ʂ
Ξχϝʔγϣϯͷछྨ 55
Ξχϝʔγϣϯ ʢ݁ՌΛৼಈͤ͞Δʣ 56 10pxҠಈͷΞχϝʔγϣϯΛ̑ճ܁Γฦ͢
ຊͷ͓͞Β͍ • Viewͷछྨ͝ͱͷ͍ํΛ֮͑Α͏ • ཱମతʹViewͷߏΛΠϝʔδͰ͖Δͱ٢ • animationΛָ͍ͬͯ͠ΞϓϦʹ͠Α͏ʂ 57
ࠂ 58 http://eventdots.jp/event/582698 ݄࣍̏̎̕ʂ
ࠂ 59 http://liginc.co.jp/series/spaceapps LIGϒϩά࿈ࡌ࢝Ί·ͨ͠ʂ