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
1 answer

How to block other Gesture Recognizers when one is enable

I have silly problem with gesture recognizers. In the Interface Builder I have few of them. Three of it are Pan Gesture Recognizers. One of it is in the different view. I want to block rest when this one is calling. I will be glad for good answer…
Dzeremix
  • 446
  • 1
  • 5
  • 24
1
vote
2 answers

kickstarting a touchesMoved/UIPanGestureRecognizer mid-move for a new view

Concept is that a user taps on an icon in a view, a copy of the icon pops up under the user's finger, and they can drag it around until they lift their finger. To do this, I desire the following icon has touch event add transparent whole screen…
1
vote
1 answer

Swift: Make UIGestureRecognizer affect only one UICollectionViewCell instead of all

I have a UICollectionView with cells populated from my AssignmentManager class. When the user wants to delete an assignment, they press and hold a cell for a delete button to appear on the cell they clicked. With the code below, the delete button…
1
vote
0 answers

Switch target of UIGestureRecognizer mid-gesture?

I have a scrollview within ViewControllerA. When a user is at the end of the scrollview during a pan gesture, it automatically transitions to ViewControllerB which has it's own scrollview. This transition works fine. However, after transitioning to…
Aaron
  • 6,466
  • 7
  • 37
  • 75
1
vote
1 answer

How to restrict a draggable UIView to specific bounds

I have a UIImageView which I have made Draggable via a custom class called DraggableImageView2. The class is then instantiated in a UIViewController with an image and can be dragged within a UIView. The thing is I want to restrict the UIImageView…
Lavvo
  • 1,024
  • 3
  • 16
  • 35
1
vote
3 answers

How can I detect a double tap on UITabBarItem?

I've tried adding a gesture recogniser, not realising that it isn't possible with a UITabBarItem, here is what I did: Any other suggestions?
Omar Sinan
  • 117
  • 2
  • 10
1
vote
1 answer

Swipe Gesture UIImageView in UITableViewCell

I can't seem to get my swipe gesture recognizer to work for an image view inside of a table view cell. I have confirmed that images.count > 1. if images.count > 0 { let imageUrlString = images[0] as String let…
raginggoat
  • 3,570
  • 10
  • 48
  • 108
1
vote
1 answer

Restrict a draggable UIView to bounds of SuperView

assume we have a UITableViewCell with an inner big custom UIImageView, like the image below: I have added UILongPressGestureRecOgnizer to the UITableViewCell, so after longPress user can move this big image. but I want this movement be in the bound…
Hashem Aboonajmi
  • 13,077
  • 8
  • 66
  • 75
1
vote
0 answers

tvOS: detecting pause button press

I am trying to detect when a user presses the play/pause button on the remote. I have created a tap gesture recognizer and attached it to the view of a AVPlayerViewController subclass. UITapGestureRecognizer *tapGestureRecognizer =…
1
vote
2 answers

How to know super class designated initializers?

I am in need of subclassing, compiler warning says "Must call a designated initializer of the superclass", but i can not find them, where should i look for designated initializers?, i would like to know where to look for them independent of the…
Juan Boero
  • 6,281
  • 1
  • 44
  • 62
1
vote
1 answer

Using gestureRecognizer: shouldRecognizeSimultaneouslyWithGestureRecognizer

I'm trying to detect up and down swipes simultaneously on my app. I have a SKScene and I'm adding the gesture recognizer in func didMoveToView: view I have set the delegate: UIGestureRecognizerDelegate, and have the following func all returning…
JoakimE
  • 1,820
  • 1
  • 21
  • 30
1
vote
2 answers

Why does a check for UIGestureRecognizer find it on iPhone OS 3.0, when it was introduced in 3.2?

I'm using UIGestureRecognizer for the first time and I want my app to run on iOS 3.0 onwards. Since Apple clearly states that the library is available in iOS 3.2 and later I used the following code: // Make sure that Gesture recognition technology…
1
vote
1 answer

How to pass indexPath.row through the tag property with UILongPressGestureRecognizer in Swift?

This is my code: func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCellWithReuseIdentifier("cell", forIndexPath: indexPath)…
1
vote
1 answer

how to appoint a UItapGesture recognizer to a CGpoint for a button

I am creating a game ad i am having a hard time creating a jump button. I have created the jump up and fall down SKaction sequence which works perfect here is how it works. func JumpArrow () { self.addChild(jumpArrow) jumpArrow.position =…
gkolman
  • 189
  • 10
1
vote
0 answers

UILongPressGestureRecognizer on TableViewCell

I have a long press gesture on my table view cell (only have 1 row) and it opens a popup. When I dismiss this popup, and tap on the cell again, somehow it doesn't register the first tap. The cell touchesBegan does get called but in…
Henny Lee
  • 2,970
  • 3
  • 20
  • 37
1 2 3
99
100