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
650
Apple HIG 正式名称クイズ結果発表 / HIG Quiz Result
usamik26
0
200
ゆめみ大技林製作委員会の立ち上げの話 / daigirin project
usamik26
0
340
@ViewLoadingプロパティラッパの紹介と自前で実装する方法 / @ViewLoading property wrapper implementation
usamik26
0
500
これからUICollectionViewを実践活用する人のためのガイド / Guide to UICollectionView
usamik26
1
760
Xcodeとの最近の付き合い方のはなし / Approach To Xcode
usamik26
2
690
UICollectionView Compositional Layout
usamik26
0
810
Coding Swift with Visual Studio Code and Docker
usamik26
0
530
Swift Extension for Visual Studio Code
usamik26
2
1.1k
Other Decks in Programming
See All in Programming
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
480
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
470
エンジニアインターン「Treasure」とHonoの2年、そして未来へ / Our Journey with Hono Two Years at Treasure and Beyond
carta_engineering
0
350
CSC305 Lecture 06
javiergs
PRO
0
250
Google Opalで使える37のライブラリ
mickey_kubo
2
110
Leading Effective Engineering Teams in the AI Era
addyosmani
7
490
フロントエンド開発のためのブラウザ組み込みAI入門
masashi
6
3.1k
AIと人間の共創開発!OSSで試行錯誤した開発スタイル
mae616
2
730
Devvox Belgium - Agentic AI Patterns
kdubois
1
130
技術的負債の正体を知って向き合う
irof
0
190
Devoxx BE - Local Development in the AI Era
kdubois
0
130
はじめてのDSPy - 言語モデルを『プロンプト』ではなく『プログラミング』するための仕組み
masahiro_nishimi
3
690
Featured
See All Featured
VelocityConf: Rendering Performance Case Studies
addyosmani
332
24k
We Have a Design System, Now What?
morganepeng
53
7.8k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
46
7.7k
The Straight Up "How To Draw Better" Workshop
denniskardys
238
140k
The Illustrated Children's Guide to Kubernetes
chrisshort
49
51k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.4k
Statistics for Hackers
jakevdp
799
220k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.5k
Site-Speed That Sticks
csswizardry
13
910
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
22k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.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