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

SceneKit Basics: move node

I have a simple scene with a centered object and the camera positioned on a virtual sphere around the center (inspired from Rotate SCNCamera node looking at an object around an imaginary sphere). Now I want to be able to move the object with a two…
pawi
  • 183
  • 1
  • 12
1
vote
2 answers

UISwipeGestureRecognizer throw unrecognised selector sent error

I am getting unrecognized selector sent error in my iOS application. I tried solving the issue based on the answers mentioned in other similar thread but failed. Please have a look at the code below and help me with this. Thanks class…
Vyshakh
  • 632
  • 1
  • 11
  • 29
1
vote
0 answers

Maintain frame of UIView after UIGestures

I'm working on an iPad app that will use UIGestureRecognizers to allow the user to pan, scale and rotate objects (subclass of UIView) on the screen. I understand that the [UIView frame] property isn't valid after a transform is done, so I'm trying…
mbm29414
  • 11,558
  • 6
  • 56
  • 87
1
vote
0 answers

How to ignore pan gestures on transparent parts of UIImageViews?

I want to use a pan gesture on visible UIImageViews's UIImage But this functionality is not implementing in objective c. I have a UIImageView with P - Shaped and i have a UIView as it is sub view of p-shaped imageview. Now i want to move this view…
sureshJangid
  • 145
  • 9
1
vote
1 answer

UIGestureRecognizer doesnt work and makes app slow

In map view, I want to make that if user touches anywhere in the map, app stops updating location..but seems like nothing happens and it takes around 10-15 seconds for actions to work in the app ( makes app really slow and laggy ) I have been using…
1
vote
0 answers

canEditRowAtIndexPath works on fast swipe

I am using this popup in my project. In my ViewController class i'm using (UITapGestureRecognizer, UILongPressGestureRecognizer) and left, right, up, down UISwipeGestureRecognizer. In my popup class i create tableView. From my ViewController class…
ZAFAR007
  • 3,049
  • 1
  • 34
  • 45
1
vote
1 answer

Handle swipes on UICollectionView cells: implement handler on UICollectionView or on each cell?

The goal is to handle swipes on UICollectionView cells. Each swipe left should present a delete option for the cell upon which the swipe occurred. The current implementation attaches a swipe gesture recognizer to the UICollectionView then checks for…
Crashalot
  • 33,605
  • 61
  • 269
  • 439
1
vote
2 answers

How can I detect a swipe, but not a swipe from the edge?

In my app, I want to detect an upwards swipe. So of course, I added a UISwipeGestureRecognizer to the view of the view controller. As expected, this recognizer detects swipe very well. But a bad thing about this is that a swipe from bottom edge is…
Sweeper
  • 213,210
  • 22
  • 193
  • 313
1
vote
1 answer

Create a UIImage with UIGestureRecognizer at runtime

I would like to be able to add a new UIImageView of a certain size which should have a few UIGestureRecognizers detecting touch on the UIImageView. How does one subclass UIImageView or how would this be best achieved? I want the user to be able to…
some_id
  • 29,466
  • 62
  • 182
  • 304
1
vote
1 answer

Makes an UIImageview rotate depending on another UIImageview rotation

I need to make an icon rotate depending on the current rotation of another UIImageview. For that I have one UIImageView which movement is controlled by a rotation user gesture. I also have an UIView which contains icons that I need to rotate…
1
vote
0 answers

Dragging and dropping an UIView to the center of another UIView

I am using these pieces of code to make coordinates global. let referenceView = self.view let dropArea = referenceView.convertRect(self.dropAreaView1.bounds, fromView: self.dropAreaView1) let center =…
Mamedoff
  • 195
  • 1
  • 2
  • 13
1
vote
3 answers

When creating a UIGestureRecognizer, why does its action use a #selector?

Take this code, for example. let swipe = UISwipeGestureRecognizer( target: self, action: #selector(SomeClass.someFunction) Why is the action #selector(MyClass.function)? Why can't it just be MyClass.function without the selector…
1
vote
1 answer

how to get only two gesture work together and one separetly

I am using three gesture named Pan, Pinch and Rotate. I want To use Pinch and Rotate gesture together and Pan separate. I am using gestureDelegate method like below : func gestureRecognizer(_: UIGestureRecognizer, …
JAck
  • 854
  • 9
  • 18
1
vote
1 answer

Often Inadvertently enter one of ScrollView's sub-items when scrolling the ScrollView

When I am scrolling a ScrollView, it's very often that it enters the item of the ScrollView by accident. How can I solve this problem? Is it because of the scroll gesture duration? How can I more clearly identify between the tap-gesture and…
Wayne Chen
  • 305
  • 2
  • 15
1
vote
1 answer

2 UIPageViewControllers gestures conflict

I've got 2 UIPageViewControllers one inside other, both with horizontal scroll. One fullscreen, containing all the user info, another - photo gallery for this user. Behavior: when i swipe all the user photos, it swipes the fullscreen. But sometimes,…