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
stackViewを使ってボタンをつくった話
Search
sun54907
November 28, 2017
Programming
0
950
stackViewを使ってボタンをつくった話
potatotips #45 で話したものです。
sun54907
November 28, 2017
Tweet
Share
More Decks by sun54907
See All by sun54907
CreateMLを使ってサクラを判定しよう | iOSDC 2018 LT
sun54907
1
930
既存のプロジェクトに、Firestoreを導入してみた
sun54907
1
1.1k
Introducing Password AutoFill
sun54907
1
530
3年間作り続けて来たアプリをSwift化した話
sun54907
0
6.6k
Other Decks in Programming
See All in Programming
Compose 1.7のTextFieldはPOBox Plusで日本語変換できない
tomoya0x00
0
200
「今のプロジェクトいろいろ大変なんですよ、app/services とかもあって……」/After Kaigi on Rails 2024 LT Night
junk0612
5
2.2k
카카오페이는 어떻게 수천만 결제를 처리할까? 우아한 결제 분산락 노하우
kakao
PRO
0
110
광고 소재 심사 과정에 AI를 도입하여 광고 서비스 생산성 향상시키기
kakao
PRO
0
170
Hotwire or React? ~アフタートーク・本編に含めなかった話~ / Hotwire or React? after talk
harunatsujita
1
120
TypeScriptでライブラリとの依存を限定的にする方法
tutinoko
3
700
色々なIaCツールを実際に触って比較してみる
iriikeita
0
330
ActiveSupport::Notifications supporting instrumentation of Rails apps with OpenTelemetry
ymtdzzz
1
250
Outline View in SwiftUI
1024jp
1
340
RubyLSPのマルチバイト文字対応
notfounds
0
120
Streams APIとTCPフロー制御 / Web Streams API and TCP flow control
tasshi
2
360
Pinia Colada が実現するスマートな非同期処理
naokihaba
4
230
Featured
See All Featured
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
Making the Leap to Tech Lead
cromwellryan
133
8.9k
Designing for Performance
lara
604
68k
Building Your Own Lightsaber
phodgson
103
6.1k
Raft: Consensus for Rubyists
vanstee
136
6.6k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
0
110
Dealing with People You Can't Stand - Big Design 2015
cassininazir
364
24k
Become a Pro
speakerdeck
PRO
25
5k
Bash Introduction
62gerente
608
210k
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Transcript
STACKVIEWΛͬͯ ɹϘλϯͭͬͨ͘
ςΩετ ࣗݾհ ▸ αϯʢւ ʣ ▸ גࣜձࣾαΠόʔΤʔδΣϯτ ▸ גࣜձࣾϚονϯάΤʔδΣϯτ ▸
@sun54907
ςΩετ ͏ͪͷΞϓϦ ▸ λοϓϧ
ςΩετ λοϓϧੜ ▸ 20145݄ϦϦʔε ▸ Swift 95% ▸ Swift 4
ରԠத ▸ ઌʑ݄ʹiOS8ΛΓ·ͨ͠
ςΩετ ։ൃͷ ▸ λοϓϧੜͰίϯϙʔωϯτԽΛਐΊ͍ͯΔ ▸ ৭UIύʔπͷ౷ҰΛਐΊ͍ͯΔ ▸ ن֨Խ͞ΕͨϘλϯΛ࡞Δ͜ͱʹͳͬͨ
Ϙλϯͷ
ςΩετ Ϙλϯͷཁ݅ ▸ λΠτϧɺλΠτϧࠨͷը૾ɺλΠτϧӈͷը૾͕͋Δ ▸ λΠτϧ৭എܠ৭͕ύλʔϯଘࡏ͢Δ ▸ ݟͨͷߴ͕͞28px͘Β͍ͷϘλϯ͋Δ ▸ ༰ʹ߹Θͤͨ෯ʹͳͬͨΓɺݻఆ෯ʹͳͬͨΓ͢Δ
Ϙλϯϥϕϧ Ϙλϯϥϕϧ Ϙλϯϥϕϧ Ϙλϯϥϕϧ ※σβΠϯ։ൃதͷͷͰ͢ɻ࣮ࡍͷ൛ͱҟͳΔՄೳੑ͕͋Γ·͢
ICON BUTTON VIEW https://github.com/sun54907/IconButtonView
ςΩετ ͍ํ let buttonView = ComponentButtonView.instantiate( data: .init(text: “Ϙλϯϥϕϧ”), style:
.medium(.fill), colorType: .primary ) stackView.addArrangedSubview(buttonView)
ͨ͠ ɹ ϙΠϯτ
STACKVIEWͰ WRAP_CONTENT
ςΩετ Ϙλϯͷཁ݅ ▸ λΠτϧɺλΠτϧࠨͷը૾ɺλΠτϧӈͷը૾͕͋Δ ▸ λΠτϧ৭എܠ৭͕ύλʔϯଘࡏ͢Δ ▸ ݟͨͷߴ͕͞28px͘Β͍ͷϘλϯ͋Δ ▸ ༰ʹ߹Θͤͨ෯ʹͳͬͨΓɺݻఆ෯ʹͳͬͨΓ͢Δ
ςΩετ Ϙλϯͷཁ݅ ▸ λΠτϧɺλΠτϧࠨͷը૾ɺλΠτϧӈͷը૾͕͋Δ ▸ λΠτϧ৭എܠ৭͕ύλʔϯଘࡏ͢Δ ▸ ݟͨͷߴ͕͞28px͘Β͍ͷϘλϯ͋Δ ▸ ༰ʹ߹Θͤͨ෯ʹͳͬͨΓɺݻఆ෯ʹͳͬͨΓ͢Δ
ςΩετ ▸ ༰ʹ߹Θͤͨ෯…·͋ɺautoLayoutͰ৭ʑͰ͖Δ͔ͳ… ▸ ͰςΩετͱը૾Ͱ࡞Δ͔ΒɺͦΕͧΕ͕͋Δ߹ͱͳ͍ ߹ରԠ͢Δͷ໘…
ͦΕɺSTACKVIEWͳΒͰ͖ΔΑ
ςΩετ STACKVIEWͱ ▸ iOS9͔Β͑Δػೳ ▸ AutoLayout Λઃఆ͢Δ View Λάϧʔϐϯάͯ͠ɺ·ͱΊ ੍ͯΛઃఆ͢Δ͜ͱ͕Ͱ͖Δ
▸ https://qiita.com/yucovin/items/ff58fcbd60ca81de77cb
STACK VIEW direction
STACK VIEW thirdView.isHidden = true
STACK VIEW
STACK VIEW ࣗಈతʹௐ͞ΕΔʂ
ࣗಈతʹௐ͞Εͨ݁Ռ
ςΩετ ଞͷϙΠϯτ ▸ Ϙλϯͷݟͨͷେ͖͞ΑΓɺ࣮ࡍʹλοϓͰ͖ΔൣғΛେ ͖͘͢Δ ▸ ߴ͞จࣈͷେ͖͞ΛܾΊΔύϥϝʔλΛprotocolʹ͠ɺ͋ Δఔࣗ༝ʹΧελϚΠζՄೳʹͨ͠
ςΩετ ▸ ৭ͷࢦఆ͕୯৭͔͠ରԠͯ͠ͳ͍ͷͰɺόϦΤʔγϣϯΛͭ ͚͍ͨ ▸ λοϓͯ͠৭͕มΘΔͷɺnormal, highlighted, disableͷ3 ύλϯ͔͠ͳ͍ͷͰɺશ෦ʹରԠ͍ͨ͠
▸ ໊લ͕͋Μ·Γؾʹೖͬͯͳ͍ ▸ xib͔Βੜͯ͠Δ͕ɺશ෦ίʔυͰੜͨ͠ํ͕͍қͦ͏ ▸ ެ։ͯ͠Δ͚Ͳɺ·ͩಈ͔ͳ͍
͋ΜͳΜී௨͡ΌΜ ࡞Γ͕ѱ͍ ͬͱ៉ྷʹͰ͖Δ ͦΜͳΓํ͋Δͷ͔ʙ ษڧʹͳͬͨͳʙ ҙݟɺ൷ืू͓ͯ͠Γ·͢ʂ ϚϦΦΦσοηΠ Γ͍ͨ
͝੩ௌ ͋Γ͕ͱ͏͍͟͝·ͨ͠