Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get trackpad / mouse wheel scrolling events in MacOS Catalyst app?

We built our iPad app for MacOS using Catalyst and I cannot figure out how to get two-finger trackpad scrolling gestures to work in a custom UIView. The standard UIKit components (e.g., UITableView) scroll with the standard two-finger trackpad scrolling gestures. But how do you handle them in a custom UIView?

The custom UIViewViewController adds a typical UIPanGestureRecognizer which invokes the gesture handler method when the trackpad is pressed and I move my finger. But it doesn't invoke the handler with just two fingers brushing the trackpad.

like image 429
LenK Avatar asked Aug 28 '19 23:08

LenK


Video Answer


2 Answers

You can do this now in iOS 13.4 using this code:

panGesture.allowedScrollTypesMask = UIScrollTypeMask.continuous

https://developer.apple.com/documentation/uikit/uipangesturerecognizer/3538978-allowedscrolltypesmask

like image 106
robhasacamera Avatar answered Oct 07 '22 20:10

robhasacamera


Confirmed by Apple DTS that this is not currently possible.

We have reviewed your request and have concluded that there is no supported way to achieve the desired functionality given the currently shipping system configurations.

(Feb 2020)

like image 27
Confused Vorlon Avatar answered Oct 07 '22 22:10

Confused Vorlon