I'd like to be able to list all currently active gesture recognizers (so I can temporarily disable them). Is this possible somehow?
The gesture recognizers built by factories in this set participate in the gesture arena for each pointer that was put down on the widget. If any of these recognizers win the gesture arena, the entire pointer event sequence starting from the pointer down event will be dispatched to the platform view.
When the gesture recognizer detects the gesture, it will call the event handler method on the target. Declare the method you want called by the gesture recognizer. Gesture recognizers call the same selector as it transitions through various states.
Drag a Gesture recognizer from the Object Library and drop it onto the View you want the Gesture to be attached to. NOTE: You can see which view the Gesture Recognizer is attached to by ctrl + Clicking on the Gesture Recognizer in the Document Outline. Ctrl-drag from your Gesture Recognizer to the ViewController swift file to create an action.
This is not nessesary for elements which natively support input, such as a Button. This example creates a tap gesture recognizer and associates it with an image. When the image is double tapped, it will become semi-transparent.
Use the UIView's gestureRecognizers
property:
for (UIGestureRecognizer *recognizer in self.gestureRecognizers)
{
//Do something with recognizer
}
More reading: UIView
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With