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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
USAMI Kosuke
October 31, 2022
Programming
0
1.3k
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
690
Apple HIG 正式名称クイズ結果発表 / HIG Quiz Result
usamik26
0
240
ゆめみ大技林製作委員会の立ち上げの話 / daigirin project
usamik26
0
370
@ViewLoadingプロパティラッパの紹介と自前で実装する方法 / @ViewLoading property wrapper implementation
usamik26
0
530
これからUICollectionViewを実践活用する人のためのガイド / Guide to UICollectionView
usamik26
1
790
Xcodeとの最近の付き合い方のはなし / Approach To Xcode
usamik26
2
710
UICollectionView Compositional Layout
usamik26
0
850
Coding Swift with Visual Studio Code and Docker
usamik26
0
550
Swift Extension for Visual Studio Code
usamik26
2
1.1k
Other Decks in Programming
See All in Programming
AIコードレビューの導入・運用と AI駆動開発における「AI4QA」の取り組みについて
hagevvashi
0
500
エラーログのマスキングの仕組みづくりに役立ったASTの話
kumoichi
0
250
それはエンジニアリングの糧である:AI開発のためにAIのOSSを開発する現場より / It serves as fuel for engineering: insights from the field of developing open-source AI for AI development.
nrslib
0
300
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
760
Claude Codeセッション現状確認 2026福岡 / fukuoka-aicoding-00-beacon
monochromegane
4
440
どんと来い、データベース信頼性エンジニアリング / Introduction to DBRE
nnaka2992
1
310
[PHPerKaigi 2026]PHPerKaigi2025の企画CodeGolfが最高すぎて社内で内製して半年運営して得た内製と運営の知見
ikezoemakoto
0
160
AI活用のコスパを最大化する方法
ochtum
0
230
API Platformを活用したPHPによる本格的なWeb API開発 / api-platform-book-intro
ttskch
1
150
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
680
Ruby and LLM Ecosystem 2nd
koic
1
1k
今からFlash開発できるわけないじゃん、ムリムリ! (※ムリじゃなかった!?)
arkw
0
120
Featured
See All Featured
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.1k
Documentation Writing (for coders)
carmenintech
77
5.3k
Building the Perfect Custom Keyboard
takai
2
710
Joys of Absence: A Defence of Solitary Play
codingconduct
1
310
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4k
New Earth Scene 8
popppiees
1
1.7k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
160
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
64
53k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
410
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
The untapped power of vector embeddings
frankvandijk
2
1.6k
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