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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
sun54907
November 28, 2017
Programming
1.1k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
stackViewを使ってボタンをつくった話
potatotips #45 で話したものです。
sun54907
November 28, 2017
More Decks by sun54907
See All by sun54907
CreateMLを使ってサクラを判定しよう | iOSDC 2018 LT
sun54907
1
1.4k
既存のプロジェクトに、Firestoreを導入してみた
sun54907
1
1.2k
Introducing Password AutoFill
sun54907
1
590
3年間作り続けて来たアプリをSwift化した話
sun54907
0
6.9k
Other Decks in Programming
See All in Programming
komatsuna「分散システムにおけるバグ分析手法」
komatsunaqa
0
220
わからない話を追いかけたら、プログラミング言語を作る側にいた
ydah
3
440
為什麼你並不需要ViewModel / No, you don't need a ViewModel
lovee
1
480
Prismを使った型安全な暗号化_関数型まつり2026
_fhhmm
0
170
琵琶湖の水は止められてもNet--HTTPのリトライは止められない / You might be able to stop the water flow of Lake Biwa but you can't stop Net::HTTP retries
luccafort
PRO
0
540
Google Apps Script で Ruby を動かす
kawahara
0
130
なぜ関数型プログラミングで「型」と「証明」が語られるのか #fp_matsuri
kajitack
3
1.1k
Claude Team Plan導入・ガイド
tk3fftk
0
250
torikago - Ruby::Boxで照らすモジュラモノリスの実行境界
se4weed
1
330
Laravelで学ぶ Webアプリケーションチューニング入門/web_application_tuning_101
hanhan1978
4
1.6k
型も通る、synthも通る、それでも危ない 〜AIのCDKの権限とコストを機械で検証する〜 / It Passes Type Checks, It Passes Synth Checks, but It’s Still Risky — Automatically Verifying Permissions and Costs in AI’s CDK —
seike460
PRO
1
520
php-fpmのプロセスが枯渇した日-調査・対処・そして本当にやるべきだったこと-
shibuchaaaan
0
210
Featured
See All Featured
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.2k
Designing for Performance
lara
611
70k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
480
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
420
Speed Design
sergeychernyshev
33
2k
The Invisible Side of Design
smashingmag
301
52k
Building AI with AI
inesmontani
PRO
1
1.1k
So, you think you're a good person
axbom
PRO
2
2.1k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
230
Embracing the Ebb and Flow
colly
88
5.1k
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͔Βੜͯ͠Δ͕ɺશ෦ίʔυͰੜͨ͠ํ͕͍қͦ͏ ▸ ެ։ͯ͠Δ͚Ͳɺ·ͩಈ͔ͳ͍
͋ΜͳΜී௨͡ΌΜ ࡞Γ͕ѱ͍ ͬͱ៉ྷʹͰ͖Δ ͦΜͳΓํ͋Δͷ͔ʙ ษڧʹͳͬͨͳʙ ҙݟɺ൷ืू͓ͯ͠Γ·͢ʂ ϚϦΦΦσοηΠ Γ͍ͨ
͝੩ௌ ͋Γ͕ͱ͏͍͟͝·ͨ͠