Questions tagged [uipangesturerecognizer]

UIPanGestureRecognizer is a concrete subclass of UIGestureRecognizer that looks for panning (dragging) gestures. The user must be pressing one or more fingers on a view while they pan it. Clients implementing the action method for this gesture recognizer can ask it for the current translation and velocity of the gesture.

A panning gesture is continuous. It begins (UIGestureRecognizerStateBegan) when the minimum number of fingers allowed (minimumNumberOfTouches) has moved enough to be considered a pan. It changes (UIGestureRecognizerStateChanged) when a finger moves while at least the minimum number of fingers are pressed down. It ends (UIGestureRecognizerStateEnded) when all fingers are lifted.

Clients of this class can, in their action methods, query the UIPanGestureRecognizer object for the current translation of the gesture (translationInView:) and the velocity of the translation (velocityInView:). They can specify the view whose coordinate system should be used for the translation and velocity values. Clients may also reset the translation to a desired value.

Whole document - UIPanGestureRecognizer

1066 questions
-1
votes
1 answer

pan gesture recongizer not working with if statement

In my swift code below i have 2 objects with the goal of only one of them having a pan gesture applied to them at a time. Right now my code works with one of the boxes but when the if statement is applied I can control the other box by touching the…
Sam Burns
  • 65
  • 1
  • 10
-1
votes
1 answer

How to fling the sprite in the direction of a swipe SpriteKit

So I figured out how to move my sprite up down left and right with swipes, but I was wondering if there was a way for the sprite to be flung in any direction depending on the swipe direction of the user. How can one do this in SpriteKit
Evonic
  • 25
  • 1
  • 4
-1
votes
3 answers

Entering text into textfield causing uipangesture object to move back to its orginal position

My swift code below has a image view connected to a pangesture. When something is entered into a textfield when after the image view is moved. The image view reverts back to its original position.The gif represents that what is going on. I just…
user12655184
-1
votes
1 answer

Draggable UIView is interacting undesirably with Tab Bar

I have a UIView that I can drag around the screen via UIPanGestureRecognizer. However, when I drag it down to the bottom of the screen, the view automatically starts to squish vertically when it touches the tab bar. If I keep dragging downward, it…
tariq
  • 501
  • 2
  • 4
  • 11
-1
votes
1 answer

Velocity and translation in UIPanGestureRecognizer begin state

I'm handling events with UIPanGestureRecognizer when state of sender is begin. In this state I measure velocity an translation. I always get nonzero velocity. Sign of translation is usually the same as velocty (and translation is a small nonzero…
xyz_abc
  • 1
  • 2
-1
votes
1 answer

UIPanGestureRecognizer handler crashes my applications - swift

I have an application that contains a UIImageView. I have drawn a small circle in a subview of the parent UIImageView. I would like the user to be able to touch and drag the small blue circle within the main UIImageView. I have set up a…
babylon
  • 45
  • 1
  • 10
-1
votes
1 answer

didSelectItemAt not called when using UIPanGestureRecognizer in View

I am using both a tap and pan gesture in my View. The view has a UICollectionView where I am trying to call didSelectItemAthowever the method is not called. I have tried the following, but with no luck. override func viewDidLoad() { …
RileyDev
  • 2,950
  • 3
  • 26
  • 61
-1
votes
1 answer

Can I add a PanGestureRecognizer to a SKSpriteNode?

Here is my code var node = SKSpriteNode() node.size = CGSize(width: 200, height: 200) node.color = UIColor.black node.position = CGPoint(x: 100, y: 50) self.addChild(whiteBox) let myPanGestureRecognizer = UIPanGestureRecognizer(target:…
Sam
  • 57
  • 1
  • 5
-1
votes
1 answer

UIPanGestureRecognizer doesn't remember where the pan began

I have a custom subclass of UIView, which has a UIPanGestureRecognizer and all the associated stuff it needs to handle it. The idea is that, depending on where the panning started from inside my view different things shall happen. Also I'll have to…
procra
  • 535
  • 4
  • 29
-1
votes
3 answers

make pan gesture recognizer only respond when swiping down AND at the top of a tableview

I am trying to dismiss the current viewcontroller when the user swipes down at the top of the tableView. Since the tableview takes up the whole screen, my gesture and the tableView's gesture conflicts. I thought about making my…
-1
votes
1 answer

UI Pan Gesture don't work

Pan gesture added at view of my ViewController. It must to detect, what cell of collectionView i was tapped, and move it. All works good, but sometimes Pan Gesture caught "begin" and "changed" events and didn't catch any end-events (need to catch…
-1
votes
3 answers

How do I find out which direction a user is panning with UIPanGestureRecognizer?

So I am using UIPanGestureRecognizer in my project which I added to a view. I would like to know when a user either goes up, down,left or right. I am using the left and right feature to scrub through video. The up and down gesture is still to be…
user7097242
  • 1,034
  • 3
  • 16
  • 31
-1
votes
2 answers

UIPanGestureRecognizer right and left tableviewcell

Right now, I am developing an iOS app that uses a subclass of UITableviewCell that uses UIPanGestureRecognizer to slide left and right but FavoritesTableViewCell don't work correctly and error. error: fatal error: NSCoding not…
-1
votes
1 answer

Scrollable custom view on pan gesture

I am new to iOS, I am trying to create a scrollable custom view. Basically on tapping on any of the icons in the screen, a custom view should pop up from botton. It should have button to expand to full screen or on pan gesture it should expanded to…
-1
votes
1 answer

how to drag a UIButton Scrollview to UIView in iOS

i want to drag a button UIScrollView to another UIView using UIPanGesture. These both views are child of Xib View. I have already tried to create a copy of UIButtonView but i m not able to move this smoothly. Here is some code which i am…
1 2 3
70
71