Questions tagged [uigesturerecognizer]

UIGestureRecognizer is an abstract base class for concrete gesture-recognizer classes. A gesture-recognizer object (or, simply, a gesture recognizer) decouples the logic for recognizing a gesture and acting on that recognition. When one of these objects recognizes a common gesture or, in some cases, a change in the gesture, it sends an action message to each designated target object.

The UIGestureRecognizer class defines a set of common behaviors that can be configured for all concrete gesture recognizers. It can also communicate with its delegate (an object that adopts the UIGestureRecognizerDelegate protocol), thereby enabling finer-grained customization of some behaviors.

A gesture recognizer operates on touches hit-tested to a specific view and all of that view’s subviews. It thus must be associated with that view. To make that association you must call the UIView method addGestureRecognizer:. A gesture recognizer does not participate in the view’s responder chain.

A gesture recognizer has one or more target-action pairs associated with it. If there are multiple target-action pairs, they are discrete, and not cumulative. Recognition of a gesture results in the dispatch of an action message to a target for each of those pairs. The action methods invoked must conform to one of the following signatures:

 - (void)handleGesture;
 - (void)handleGesture:(UIGestureRecognizer *)gestureRecognizer;

Resources:

3632 questions
1
vote
0 answers

Can't get shouldRecognizeSimultaneouslyWithGestureRecognizer working

I'm working with Swift 3, Xcode and SpriteKit. I have two gestures: UIPanGestureRecognizer and UIPinchGestureRecognizer let pinchGesture = UIPinchGestureRecognizer() let panGesture = UIPanGestureRecognizer() override func didMove(to view: SKView) {…
1
vote
1 answer

Issues using CGAffineTransform and UIPanGestureRecognizer together

I have a view that contains a subview that contains a pan gesture. subview contains an additional subSubview that also has a pan gesture recognizer of its own. view -> subview -> subSubview Normally, both subview and subSubview pan without…
Frankie
  • 11,508
  • 5
  • 53
  • 60
1
vote
2 answers

Small panGesture is taking as singleTap gesture, why? iOS

I have implemented all the gestures in my app, and returned in shouldRecognizeSimultaneouslyWithGestureRecognizer as YES. I am facing problem is when I pan a little, it consider it as a singleTap and the code for singleTap is executing. I can…
Saheb Singh
  • 555
  • 4
  • 18
1
vote
0 answers

Detecting tap in UIPickerView current selection

This is the same question as UIPicker detect tap / touch on currently selected row. I am updating its Swift 2 solution to Swift 3. But my tap handler is never called for the PickerView. (It is if I attach the Recognizer to the background UIView.) I…
Andrew Duncan
  • 3,553
  • 4
  • 28
  • 55
1
vote
1 answer

UITapGestureRecognizer not working for specific [UIView] array

I have the following piece of code. It's a third party library for a menu (named CarbonKit). When I try to select a specific segment (tab) and add a gesture recognizer, it doesn't work. Any ideas what I'm doing wrong? To be clear, I placed a…
1
vote
1 answer

Disable a longpress

How can I disable a longpress? I have set a longpress in a viewcontroller and it's working ok but i'd like it to stop working after I press another button. I can add a flag and set it to false after I press button B and than the long press stops…
H.N.
  • 1,207
  • 2
  • 12
  • 28
1
vote
1 answer

Manage long press on UITextfiled without disabling context menu?

I've UITableView and its cell have one UITextField. Now I added long gesture in UITextField but it not working. When I tap long gesture on textfield it always show context menu (select,copy cut,past,etc.). My question is that how to manage long…
Ekta Padaliya
  • 5,743
  • 3
  • 39
  • 51
1
vote
0 answers

Spritekit - How to add a swipe gesture to multiple nodes at once?

I'm trying to add a swipe gesture for multiple nodes at once but it seems to only be working for the first node. When I try and swipe the other nodes it doesn't register there is a swipe. There is only one node but it is copied many times in the…
SwiftyJD
  • 5,257
  • 7
  • 41
  • 92
1
vote
0 answers

How to add a segue from the last page of a UIPageViewController with Swipe gesture

Im trying to implement a tutorial with 3 screens and at the last page, when the user swipes, the app should go to the main UIViewController. When the pageViewController data source is set to self, no swipe gestures are recognized. Is there a work…
user1818125
  • 221
  • 1
  • 2
  • 8
1
vote
1 answer

Trouble moving CollectionViewCell to the end

I have a UICollectionView in a UIViewController. I've configured a gesture recognizer to move cells. It works fine for moving a cell to any index except the end. Most aggravatingly, the app doesn't crash when I attempt to move a cell to the end--it…
Adrian
  • 16,233
  • 18
  • 112
  • 180
1
vote
1 answer

Swift: how to detect if swipe occurred in subview?

Assume a UIView, ParentView, contains a subview, ChildView, and other subviews. The UIViewController attaches a swipe gesture recognizer to ParentView. Swipes on ChildView trigger this swipe handler. Inside of ParentView's swipe handler, is there a…
Crashalot
  • 33,605
  • 61
  • 269
  • 439
1
vote
0 answers

IOS drawing on an image but my touch gesture cuts off in the middle of movement

I am developing some functionality that will let the user "draw" on an image by placing their finger on the screen and moving it around. I have the following code (taken from the tutorial…
Tyler Hilbert
  • 2,107
  • 7
  • 35
  • 55
1
vote
1 answer

button action gets called before double tap gesture method

I've a scrollview on which one button is added, now I want to give action as well as double tap gesture to the button. If the button is on UIView, both action of the button and double tap gesture methods work perfectly. But if the button is present…
1
vote
1 answer

How Could I implement clockwise and counter clockwise gesture in android

We want to detect user finger gesture clockwise and counterclockwise like below shape.Also we want to trigger an action in clockwise motion in on 4 O'clock,and trigger an action in counterclockwise motion on 8 O'clock. descriptions in Image we found…
Hadi Samadbin
  • 237
  • 3
  • 17
1
vote
1 answer

tvOS: Is there anyway to detect a long press of an arrow button?

So I've been trying to detect a long press of one of the Apple TV remote arrow buttons (triggered when touching the edges of the touch pad) and it seems like it doesn't work for the arrows, only for the physical buttons you click down. Basically: //…