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.1k
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
650
Apple HIG 正式名称クイズ結果発表 / HIG Quiz Result
usamik26
0
190
ゆめみ大技林製作委員会の立ち上げの話 / daigirin project
usamik26
0
340
@ViewLoadingプロパティラッパの紹介と自前で実装する方法 / @ViewLoading property wrapper implementation
usamik26
0
490
これからUICollectionViewを実践活用する人のためのガイド / Guide to UICollectionView
usamik26
1
760
Xcodeとの最近の付き合い方のはなし / Approach To Xcode
usamik26
2
680
UICollectionView Compositional Layout
usamik26
0
800
Coding Swift with Visual Studio Code and Docker
usamik26
0
520
Swift Extension for Visual Studio Code
usamik26
2
1.1k
Other Decks in Programming
See All in Programming
モバイルアプリからWebへの横展開を加速した話_Claude_Code_実践術.pdf
kazuyasakamoto
0
300
Jakarta EE Core Profile and Helidon - Speed, Simplicity, and AI Integration
ivargrimstad
0
320
DockerからECSへ 〜 AWSの海に出る前に知っておきたいこと 〜
ota1022
5
1.9k
Claude Codeで挑むOSSコントリビュート
eycjur
0
190
AIでLINEスタンプを作ってみた
eycjur
1
220
Swift Updates - Learn Languages 2025
koher
1
400
パッケージ設計の黒魔術/Kyoto.go#63
lufia
3
410
CSC305 Summer Lecture 12
javiergs
PRO
0
130
MCPで実現するAIエージェント駆動のNext.jsアプリデバッグ手法
nyatinte
7
1k
[FEConf 2025] 모노레포 절망편, 14개 레포로 부활하기까지 걸린 1년
mmmaxkim
0
1.4k
2025 年のコーディングエージェントの現在地とエンジニアの仕事の変化について
azukiazusa1
17
7.7k
KessokuでDIでもgoroutineを活用する / Go Connect #6
mazrean
0
140
Featured
See All Featured
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
Raft: Consensus for Rubyists
vanstee
140
7.1k
Building a Modern Day E-commerce SEO Strategy
aleyda
43
7.5k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
15
1.6k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.5k
Reflections from 52 weeks, 52 projects
jeffersonlam
351
21k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
44
2.5k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
111
20k
Done Done
chrislema
185
16k
Unsuck your backbone
ammeep
671
58k
Intergalactic Javascript Robots from Outer Space
tanoku
272
27k
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