Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Gestures - updated with delegates
-
UIKit gestures wrapper has been updated with support for fine-tuning recognition when several gestures are involved. Thanks to @JonB for all the difficult bits of code.
Here's the updated section from the readme:
Fine-tuning gesture recognition
If you need to control which gestures are recognized in which situation, you can override some methods.
For example, by default only one gesture recognizer will be successful, but if you want to enable both zooming (pinch) and panning at the same time, allow both recognizers:
g = Gestures() g.recognize_simultaneously = lambda gr, other_gr: gr == Gestures.PAN and other_gr == Gestures.PINCH
The other methods you can override are
fail
andfail_other
, corresponding to the other UIGestureRecognizerDelegate methods.All regular recognizers have convenience names that you can use like in the example above:
TAP
,PINCH
,ROTATION
,SWIPE
,PAN
,SCREEN_EDGE_PAN
,LONG_PRESS
.If you need to set these per gesture, instantiate separate
Gestures
objects.If you need even finer control and are not afraid to import
objc_util
, check theobjc_*_default
methods in the code.