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
Apple Pencilのホバー機能を試す / pencil hover
Search
USAMI Kosuke
October 31, 2022
Programming
0
1.2k
Apple Pencilのホバー機能を試す / pencil hover
※ Docswell に移行しました
https://www.docswell.com/s/usami-k/5ENQN8-pencil-hover
USAMI Kosuke
October 31, 2022
Tweet
Share
More Decks by USAMI Kosuke
See All by USAMI Kosuke
Onsager代数とその周辺 / Onsager algebra tsudoi
usamik26
0
680
Apple HIG 正式名称クイズ結果発表 / HIG Quiz Result
usamik26
0
220
ゆめみ大技林製作委員会の立ち上げの話 / daigirin project
usamik26
0
360
@ViewLoadingプロパティラッパの紹介と自前で実装する方法 / @ViewLoading property wrapper implementation
usamik26
0
530
これからUICollectionViewを実践活用する人のためのガイド / Guide to UICollectionView
usamik26
1
780
Xcodeとの最近の付き合い方のはなし / Approach To Xcode
usamik26
2
700
UICollectionView Compositional Layout
usamik26
0
840
Coding Swift with Visual Studio Code and Docker
usamik26
0
540
Swift Extension for Visual Studio Code
usamik26
2
1.1k
Other Decks in Programming
See All in Programming
Fluid Templating in TYPO3 14
s2b
0
130
開発者から情シスまで - 多様なユーザー層に届けるAPI提供戦略 / Postman API Night Okinawa 2026 Winter
tasshi
0
200
CSC307 Lecture 04
javiergs
PRO
0
660
ThorVG Viewer In VS Code
nors
0
760
AI Agent Tool のためのバックエンドアーキテクチャを考える #encraft
izumin5210
6
1.8k
プロダクトオーナーから見たSOC2 _SOC2ゆるミートアップ#2
kekekenta
0
200
AI時代の認知負荷との向き合い方
optfit
0
150
CSC307 Lecture 01
javiergs
PRO
0
690
AIエージェント、”どう作るか”で差は出るか? / AI Agents: Does the "How" Make a Difference?
rkaga
4
2k
Oxlintはいいぞ
yug1224
5
1.3k
MDN Web Docs に日本語翻訳でコントリビュート
ohmori_yusuke
0
640
KIKI_MBSD Cybersecurity Challenges 2025
ikema
0
1.3k
Featured
See All Featured
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
110
The Invisible Side of Design
smashingmag
302
51k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
430
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.7k
So, you think you're a good person
axbom
PRO
2
1.9k
Paper Plane (Part 1)
katiecoart
PRO
0
4k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
1
97
Believing is Seeing
oripsolob
1
53
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.1k
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
150
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
170
Transcript
Apple Pencil のホバー機能を試す 宇佐見公輔 / 株式会社ゆめみ
自己紹介 宇佐見公輔(うさみこうすけ) 株式会社ゆめみ / iOSテックリード iOSDC Japan 2022で登壇、パンフレット記事執筆 Apple Pencil
のホバー機能を試す / 宇佐見公輔 / 株式会社ゆめみ 2
Apple Pencil のホバー検出 Apple PencilをiPadに直接タッチしていない状態を検出できるように なった 必要なもの: iPadOS 16.1(リリース日:2022-10-25) M2
iPad Pro(発売日:2022-10-26) Apple Pencil 2nd gen(これは以前からある) Apple Pencil のホバー機能を試す / 宇佐見公輔 / 株式会社ゆめみ 3
実機での挙動 検出されるのは、タッチパネルから約1cm以内にペン先があるとき iPadOS標準のメモアプリの例: 手書きモードで、ペン先が浮いている状態でペンのタッチ位置がプ レビュー表示される ボタンなどのUIコントロールの上にかざすと、そのコントロールが ハイライト表示される Apple Pencil のホバー機能を試す
/ 宇佐見公輔 / 株式会社ゆめみ 4
アプリでの検出方法 UIHoverGestureRecognizer を使えば良い let hover = UIHoverGestureRecognizer(target: self, action: #selector(hovering(_:)))
button.addGestureRecognizer(hover) @objc private func hovering(_ recognizer: UIHoverGestureRecognizer) { // 検出時の処理 } Appleのサンプル:Adopting hover support for Apple Pencil Apple Pencil のホバー機能を試す / 宇佐見公輔 / 株式会社ゆめみ 5
UIHoverGestureRecognizer UIHoverGestureRecognizer はiPadOS 13.0から存在している Viewの上をマウスポインターがホバーしたことを検出する iPadOS 16.1からApple Pencilのホバーも検出する つまり、マウスポインターのホバーと同じ挙動が期待されている UIコントロールのハイライト表示など
標準のUIコントロールは自動的に対応する Apple Pencil のホバー機能を試す / 宇佐見公輔 / 株式会社ゆめみ 6
zOffset UIHoverGestureRecognizer プロパティ zOffset がiPad16.1で追加 0〜1の値でタッチパネルからの距離が取得できる Apple Pencilでない場合は常に0の値 ペン先のタッチ位置のプレビュー表示に活用できる Apple
Pencil のホバー機能を試す / 宇佐見公輔 / 株式会社ゆめみ 7
プレビュー表示 どのようなプレビュー表示をするかは、現在はガイドラインがない 標準メモアプリは単純にポイント位置を点で表示している? サンプルコードでは距離によってアルファ値を変えている これは意味があるかどうか? 単純な表示でも、ユーザーにとっての使い勝手は向上する Apple Pencil のホバー機能を試す /
宇佐見公輔 / 株式会社ゆめみ 8
ホバー検出の有効化・無効化 Apple Pencil のホバー機能を試す / 宇佐見公輔 / 株式会社ゆめみ 9
まとめ M2 iPad Proのみの機能 UIHoverGestureRecognizer で検出できる 標準のUIコントロールなら何もしなくてもハイライト表示される Pencilのタッチ操作を想定するならプレビュー表示対応すると良い プレビュー表示のガイドラインはまだない Apple
Pencil のホバー機能を試す / 宇佐見公輔 / 株式会社ゆめみ 10