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
ペダルのある生活 / The Pedal
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Hiron
April 27, 2018
Programming
0
500
ペダルのある生活 / The Pedal
Mobile Act OSAKA #4で発表したスライドです。
Hiron
April 27, 2018
Tweet
Share
More Decks by Hiron
See All by Hiron
カンファレンス動画鑑賞会のススメ / Osaka.swift #1
hironytic
0
340
try! Swift Tokyo 2024 参加報告 / try! Swift Tokyo 2024 Report
hironytic
0
520
Swift on Windows ファーストインプレッション / Swift on Windows First Impression
hironytic
0
700
iPadOSDC: Multiple Windows
hironytic
5
3.5k
だったら、俺が代わりにやってやる / Swift Zoomin' Challenge
hironytic
0
230
SwiftのNeverとボトム型 / Never as a Bottom Type
hironytic
2
910
4000のワーニングと戦え!これは警告だ! / 4000 Warnings
hironytic
2
890
シンボリケート / Ore-con 2018 Summer
hironytic
3
1.2k
全部iOSにしゃべらせちゃえ! / iOSDC 2018 LT
hironytic
3
1.9k
Other Decks in Programming
See All in Programming
izumin5210のプロポーザルのネタ探し #tskaigi_msup
izumin5210
1
120
OSSとなったswift-buildで Xcodeのビルドを差し替えられるため 自分でXcodeを直せる時代になっている ダイアモンド問題編
yimajo
3
620
MDN Web Docs に日本語翻訳でコントリビュート
ohmori_yusuke
0
650
インターン生でもAuth0で認証基盤刷新が出来るのか
taku271
0
190
AI時代の認知負荷との向き合い方
optfit
0
160
Fluid Templating in TYPO3 14
s2b
0
130
SourceGeneratorのススメ
htkym
0
200
OCaml 5でモダンな並列プログラミングを Enjoyしよう!
haochenx
0
140
2026年 エンジニアリング自己学習法
yumechi
0
130
「ブロックテーマでは再現できない」は本当か?
inc2734
0
990
プロダクトオーナーから見たSOC2 _SOC2ゆるミートアップ#2
kekekenta
0
210
Best-Practices-for-Cortex-Analyst-and-AI-Agent
ryotaroikeda
1
110
Featured
See All Featured
SEO for Brand Visibility & Recognition
aleyda
0
4.2k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
0
110
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.6k
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
200
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
830
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
210
Designing Experiences People Love
moore
144
24k
Between Models and Reality
mayunak
1
190
Building Flexible Design Systems
yeseniaperezcruz
330
40k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
9.9k
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
1.9k
Transcript
ペダルのある生活 2018/04/27 Mobile Act OSAKA #4
なぜか土曜日 エライ人
自己紹介 • ひろん(一宮 浩教) • Twitter、GitHub、Qiita、 SlideShare、Speaker Deck: ➡hironytic •
株式会社 MetaMoJi(徳島勤務)
None
音楽関係の法人様 • 楽譜の共有に利用したい
iRig BlueTurn http://hookup.co.jp/products/ik-multimedia/irig-blueturn お荷物の お届けでーす
iRig BlueTurn • Bluetooth接続のハードウェアキーボードとして 動作する - MODE 1: ↑/↓ -
MODE 2: Page Up/Page Down - MODE 3: ←/→
どうなるのか考える ハードウェアキーボードに対応すればよい /以上 http://amzn.asia/iPpfS6t
ハードウェアキーボード対応(iOS) • UIKeyCommand • ファーストレスポンダーでUIKeyCommandオブジェ クトの配列を返せばよい extension UIResponder { @available(iOS
7.0, *) open var keyCommands: [UIKeyCommand]? { get } }
UIKeyCommandを返す class ViewController: UIViewController { override var canBecomeFirstResponder: Bool {
return true } override var keyCommands: [UIKeyCommand]? { return [ UIKeyCommand(input: UIKeyInputUpArrow, modifierFlags: [], action: #selector(pageUp)), UIKeyCommand(input: UIKeyInputDownArrow, modifierFlags: [], action: #selector(pageDown)), UIKeyCommand(input: UIKeyInputLeftArrow, modifierFlags: [], action: #selector(pageUp)), UIKeyCommand(input: UIKeyInputRightArrow, modifierFlags: [], action: #selector(pageDown)), ] } @objc func pageDown() { /* ࣍ͷϖʔδ */ } @objc func pageUp() { /* લͷϖʔδ */ } }
PageUp、PageDownは? • APIで定義されていない • Stack Overflowに答えがあった(*) - 文字列 "UIKeyInputPageUp", "UIKeyInputPageDown"
- Undocumented APIの使用になるかどうかは 知らんけど * https://stackoverflow.com/a/44321674/4313724 (たぶん大丈夫。知らんけど)
UIKeyCommandを返す override var keyCommands: [UIKeyCommand]? { return [ UIKeyCommand(input: UIKeyInputUpArrow,
modifierFlags: [], action: #selector(pageUp)), UIKeyCommand(input: UIKeyInputDownArrow, modifierFlags: [], action: #selector(pageDown)), UIKeyCommand(input: UIKeyInputLeftArrow, modifierFlags: [], action: #selector(pageUp)), UIKeyCommand(input: UIKeyInputRightArrow, modifierFlags: [], action: #selector(pageDown)), UIKeyCommand(input: "UIKeyInputPageUp", modifierFlags: [], action: #selector(pageUp)), UIKeyCommand(input: "UIKeyInputPageDown", modifierFlags: [], action: #selector(pageDown)), ] }
ハードウェアキーボード対応(Android) class MainActivity : AppCompatActivity() { override fun onKeyDown(keyCode: Int,
event: KeyEvent?): Boolean { when (keyCode) { KeyEvent.KEYCODE_DPAD_UP, KeyEvent.KEYCODE_DPAD_LEFT, KeyEvent.KEYCODE_PAGE_UP -> { pageDown() return true } KeyEvent.KEYCODE_DPAD_DOWN, KeyEvent.KEYCODE_DPAD_RIGHT, KeyEvent.KEYCODE_PAGE_DOWN -> { pageUp() return true } else -> { return super.onKeyDown(keyCode, event) } } } private fun pageDown() { /* ࣍ͷϖʔδ */ } private fun pageUp() { /* લͷϖʔδ */ } }
報告 ぼく「このペダルの場合、追加のSDKも特に必 要ありませんでした。お客様はこのペダルを使わ れるんですよね?」 エライ人「さあ?Amazonで最初に見つかった のを買ってみただけ」 ぼく「えっ・・・!?」
まとめ • iRig BlueTurnはハードウェアキーボード • iOSでは UIKeyCommand を使う • Androidでは
onKeyDown() を使う