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
3 answers

Long press gesture on image in tableview custom cell

I need some help. Today, I am working on table view custom cell where the cell contains an UIImageView. On the ImageView, I want to implement the long gesture. I implement code for this that is give below.. But I am doing something wrong in my…
1
vote
1 answer

How to disable multi touch on UIPageViewController?

I am asking this question because on my custom UIPageViewController, I can swipe left or right from last to first page using exactly one gesture. In other words, while I swipe with first finger, I am able to continue swiping with my second finger…
P. Pawluś
  • 298
  • 6
  • 17
1
vote
3 answers

Simulatenous independent gestures

I am making a game where player moves with two figures at a time. Each one has its own half of the screen and moves just within in. Unfortunately I found out that when I swipe with both thumbs at a time nothing happens. Not even one of my…
1
vote
2 answers

How do I trigger a collection view's didSelectItemAtIndexPath: on tap while it's scrolling?

The default behavior while a collection view is mid-scroll: tap #1: stops the scrolling tap #2: triggers didSelectItemAtIndexPath What I want while a collection view is mid-scroll: tap #1: triggers didSelectItemAtIndexPath What would be a clean,…
Aaron
  • 6,466
  • 7
  • 37
  • 75
1
vote
2 answers

UIGestureRecognizerState.Cancelled vs UIGestureRecognizerState.Failed

What is the difference between the .Cancelled and .Failed states? How does setting gesture recognizer's state to .Cancelled or .Failed affect the gesture recognizer itself? When does a gesture recognizer's state become .Cancelled and .Failed? At…
1
vote
1 answer

Ios Swift Override double tap of UItextField

I want to write a custom code on double tap on UITextField and block the default text editing and popup of the keyboard. I've tried the following and nothing has worked for me so far. Kindly help me solve this problem. let gestureArray =…
1
vote
5 answers

How To Add One UIGestureRecognizer to All UITextView without blocking textView touches

How To Add One UIGestureRecognizer to All UITextView without blocking textView touches.. i want to call a method when any one touch any UITextView. pls any one give me ans.
1
vote
1 answer

Swift - UITextField - Gesture recognizer delay

I'm using a UITextField and I'd like to trigger a function when the user is taping in the textfield, but I want to wait 1/4sec before triggering the function. How can I do that ?
Fabrice Froehly
  • 163
  • 1
  • 3
  • 10
1
vote
1 answer

Restrict Multiple Cell Edit - SWTableViewCell

How to restrict multiple cell edit(swipe) in SWTableViewCell as shown in the image below. As when one cell is swiped and other cell is being swiping, the previous cell should closed itself. Library source:…
1
vote
1 answer

UITableView background view pan gesture

I would like to use a UIView as a UITableView's background view, and I set the UITableView's content inset, so user can scroll down the table view to show the background view,also I need to add pan and drag gesture on the background view to let user…
childrenOurFuture
  • 1,889
  • 2
  • 14
  • 23
1
vote
1 answer

How to hide PKHUD using UIGestureRecognizer?

I tried to add a UIGestureRecognizer to hide the HUD when the user touches it. This is my code: let gesture = UITapGestureRecognizer(target: self, action: #selector(someAction(_:))) PKHUD.sharedHUD.contentView.userInteractionEnabled =…
mixable
  • 1,068
  • 2
  • 12
  • 42
1
vote
1 answer

Draw a border around a UITableviewCell when selected with UILongPressGestureRecognizer

I am trying to update UITableViewCell's border when the user performs a long press gesture on the cell, but it's not updating. Here is my cellForRowAtIndexPath: method let objLongPressHandler = UILongPressGestureRecognizer(target: self, action:…
Murat Kaya
  • 1,281
  • 3
  • 28
  • 52
1
vote
1 answer

touchesBegan not called on UICollectionView subclass

I have subclassed UICollectionView as CoolGridCollectionView and I have overrides the touchesBegan: and touchesEnded: methods. But those are not getting called, when I tap the cell. And that cells are having single and double tap gesture…
Shanmugaraja G
  • 2,778
  • 4
  • 31
  • 47
1
vote
2 answers

Crash while in CALayer -hitTest:

This issue really has me stumped... I have an iPad project that I use UIPanGestureRecognizer and I am using the following method call within my handlePanGesture: - (AIEnemyUnit *) hitTestForEnemyUnit:(CGPoint)where { CALayer * layer = [self…
Phil M
  • 2,103
  • 2
  • 12
  • 5
1
vote
2 answers

UITapGestureRecognizer only triggered for starting area of UIScrollView

I have several sub views added to a UIScrollView in the main view controller. Each sub view's view controller has its own tap recognizer. The problem is, only tapping in the starting area on the screen is recognised. After scrolling the view and…
1 2 3
99
100