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アプリ開発入門_03
Search
jollyjoester
February 20, 2016
Education
0
100
Swiftで作るiOSアプリ開発入門_03
Schoo講義資料
jollyjoester
February 20, 2016
Tweet
Share
More Decks by jollyjoester
See All by jollyjoester
コミュニティMTG in WWDC24
jollyjoester
0
210
BengaluruでLTしてきた
jollyjoester
0
260
try! Swift Tokyo 2024
jollyjoester
0
220
エンジニアが直接会う場の価値について
jollyjoester
8
4k
来年Proposalを出すつもりで参加するときっともっと楽しい!
jollyjoester
0
280
My favorite sessions in WWDC 23
jollyjoester
0
570
みんなでAIと戯れよう
jollyjoester
0
97
続く勉強会の作り方
jollyjoester
2
800
Code for INZAIの歩み
jollyjoester
0
350
Other Decks in Education
See All in Education
Web Application Frameworks - Lecture 4 - Web Technologies (1019888BNR)
signer
PRO
0
2.6k
不登校予防・再登校支援プログラムを提供するToCo (トーコ) の会社紹介資料 toco.mom
toco3week
0
400
Lisätty todellisuus opetuksessa
matleenalaakso
1
2.3k
Amazon Connectを利用したCloudWatch Alarm電話通知
junghyeonjae
0
260
Human Perception and Cognition - Lecture 4 - Human-Computer Interaction (1023841ANR)
signer
PRO
0
710
勉強する必要ある?
mineo_matsuya
2
1.6k
(2024) Couper un gâteau... sans connaître le nombre de convives
mansuy
2
150
"数学" をプログラミングしてもらう際に気をつけていること / Key Considerations When Programming "Mathematics"
guvalif
0
560
CompTIA Security+ SY0-601 Resumo
mariliarochas
2
2.6k
The Blockchain Game
jscottmo
0
3.7k
PSYC-560 R and R Studio Setup
jdbedics
0
520
お仕事図鑑pitchトーク
tetsuyaooooo
0
2.3k
Featured
See All Featured
It's Worth the Effort
3n
183
27k
[RailsConf 2023] Rails as a piece of cake
palkan
52
4.9k
Become a Pro
speakerdeck
PRO
25
5k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
27
4.3k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
16
2.1k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
Optimizing for Happiness
mojombo
376
70k
Visualization
eitanlees
145
15k
Why Our Code Smells
bkeepers
PRO
334
57k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.7k
Transcript
SwiftͰ࡞Δ iOSΞϓϦ։ൃೖ ̏ݶɿAutoLayoutͰΞϓϦͷݟͨΛ͑Δ 1
ࣗݾհ ࣣౡҒ೭ʢͳͳ͠·ͻͰΏ͖ʣ Reproגࣜձࣾ iPhoneΞϓϦ։ൃ͕͖ 2
ࣗݾհ 3 https://repro.io
ຊίʔεͷඪ ۤΛΓӽ͑ͯ ָ͘͠ΞϓϦ։ൃͰ͖ΔΑ͏ʹͳΔʂ 4
෭ڭࡐ վగ൛ No.1εΫʔϧߨࢣਞʹΑΔ ੈքҰड͚͍ͨ iPhoneΞϓϦ։ൃͷतۀ (ٕज़ධࣾ) 5
ࠓճͷतۀͷඪ AutoLayoutͷ͍ํΛମͰ֮͑Δʂ 6
तۀͷલఏ݅ • ͓खݩͷMacʹXcode(version7.0Ҏ্)͕Πϯετʔ ϧ͞Ε͍ͯΔ͜ͱ • ̎ݶͰ࡞ͬͨϓϩδΣΫτΛ༻ҙ͢Δ 7
ຊͷϝχϡʔ • AutoLayoutͷׂ • AutoLayoutͷઃఆͷํ • AutoLayoutͷ͍ํͷ࿅श 8
AutoLayoutͷׂ 9
AutoLayoutͱԿ͔ʁ ΞϓϦέʔγϣϯͷϢʔβΠϯλʔϑΣΠε ʢಛʹը໘ϨΠΞτʣΛ࡞͢ΔγεςϜ ͭ·ΓݟͨΛ࡞ΔͨΊͷͷ 10
AutoLayoutҎલ • ViewͷαΠζ࠲ඪΛͰࢦఆ • AutoSizingʢView͔Βͷج४ʣ 11
AutoLayoutԿ͕͍͍ͷ͔ʁ ը໘ͷେ͖͖͞ɺҬઃఆʢݴޠͳ Ͳʣͷҧ͍ʹԠͯ͡ಈతʹมԽ͢Δɺ൚ ༻తͳը໘ϨΠΞτΛ࡞Γग़͢͜ͱ͕ Ͱ͖Δʂ 12
AutoLayoutͷઃఆͷํ ·ͣͱʹ͔ͬͯ͘ΈΔ 13
ݱঢ়ͷϓϩδΣΫτ֬ೝ 14 • iPhone5sͱiPhone6PlusͰݟͨΛ ‣ γϛϡϨʔλʔͰ֬ೝ ‣ Assistant EditorͷpreviewͰ֬ೝ
ݱঢ়ͷϓϩδΣΫτ֬ೝ 15 • iPhone5sͱiPhone6PlusͰݟͨΛ ‣ γϛϡϨʔλʔͰ֬ೝ ‣ Assistant EditorͷpreviewͰ֬ೝ
Previewͷ։͖ํ 16
Previewͷ։͖ํ 17
େ͖͍ͩͱࠨ্ʹدΔ 18
ը૾ΛਅΜதʹஔ͢Δ ʢConstraintsઃఆʣ 19
ը૾ΛਅΜதʹஔ͢Δ ʢPreview֬ೝʣ 20
ϥϕϧͷҐஔΛௐ͢Δ ʢҐஔͷConstraintsઃఆʣ 21
ϥϕϧͷҐஔΛௐ͢Δ ʢαΠζͷConstraintsઃఆʣ 22
ϥϕϧͷҐஔΛௐ͢Δ ʢPreview֬ೝʣ 23
ϘλϯͷҐஔΛௐ͢Δ ʢConstraintsઃఆʣ 24 ϥϕϧͱಉ༷
ϘλϯͷҐஔΛௐ͢Δ ʢPreview֬ೝʣ 25
ԣ͖Λ֬ೝ͢Δ ʢPreview֬ೝʣ 26
ϥϕϧͷҐஔΛௐ͢Δ ʢConstraintsฤूͦͷ̍ʣ 27
ϥϕϧͷҐஔΛௐ͢Δ ʢConstraintsฤूͦͷ̎ʣ 28
ؒҧ͑ͨConstraintsΛՃͨ͠߹ ʢҟͳΔWidthΛ̎ݸઃఆʣ 29
ෆཁͳConstraintsͷআ ʢקΊʹैͬͯআʣ 30
ෆཁͳConstraintsͷআ ʢखಈͰআʣ 31
ϥϕϧΛͣΒͯ͠ΈΔ 32
Update Frames 33
Update Frames 34
Update Constraints 35
ConstraintsΛղআ 36
AutoLayoutҰཡ Align 37 Leading Edges ViewͷࠨΛἧ͑ Trailing Edges ViewͷӈΛἧ͑ Top
Edges Viewͷ্Λἧ͑ Bottom Edges ViewͷԼΛἧ͑ Holizontal Centers Viewͷԣํͷத৺ἧ͑ Vertical Centers Viewͷॎํͷத৺ἧ͑ Baselines ViewͷϕʔεϥΠϯἧ͑ Horizontal Center in Container ContainerͰࠨӈத৺ ʹஔ Vertical Center in Container ContainerͰ্Լத৺ ʹஔ
AutoLayoutҰཡ Pin 38 Spacing to nearest neighbor ͓ྡͷViewͱͷεϖʔε Width Viewͷ෯
Height Viewͷߴ͞ Equal Widths ෳͷViewΛಉ͡෯ʹ Equal Heights ෳͷViewΛಉ͡ߴ͞ʹ Aspect Ratio ViewͷॎԣൺΛݻఆ
AutoLayoutͷ͍ํ࿅श 39
࿅श༻ͷViewΛஔ͢Δ 40
࿅श༻ͷViewΛஔ͢Δ 41
ࠨԼʹݻఆ͢Δ 42
ࠨԼʹݻఆ͢Δ 43
ࠨԼʹݻఆ͢Δ 44 Update frames
͏ҰͭฒΔ 45
͏ҰͭฒΔ 46
͏ҰͭฒΔ 47
͏ҰͭฒΔ 48 Update frames
ִؒʹฒΔ 49
ִؒʹฒΔ 50
ִؒʹฒΔ 51
ִؒʹฒΔ 52
ִؒʹฒΔ 53
ִؒʹฒΔ 54
ִؒʹฒΔ 55
ִؒʹฒΔ 56
ִؒʹฒΔ 57 Update frames
ִؒʹฒΔ (Stack ViewͳΒ؆୯ɻͨͩ͠iOS9Ҏ্) 58
ִؒʹฒΔ (Stack ViewͳΒ؆୯ɻͨͩ͠iOS9Ҏ্) 59
ִؒʹฒΔ (Stack ViewͳΒ؆୯ɻͨͩ͠iOS9Ҏ্) 60
ִؒʹฒΔ (Stack ViewͳΒ؆୯ɻͨͩ͠iOS9Ҏ্) 61
ຊͷ͓͞Β͍ • ΞϓϦͷݟͨAutoLayoutͰ࡞Δ • ෦Λઃஔͯ͠Update framesΛ܁Γฦ͍ͯ͘͜͠ ͱ͕جຊʂ • AutoLayoutମͰ֮͑Δ 62
ࠂ 63 http://love-swift.connpass.com/event/25716/ ݄࣍̏Լ०ʂ
ࠂ 64 http://liginc.co.jp/?p=228155 LIGϒϩά࿈ࡌ࢝Ί·ͨ͠ʂ