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

1041 questions
42
votes
3 answers

Intercepting pan gestures over a UIScrollView breaks scrolling

I have a vertically-scrolling UIScrollView. I want to also handle horizontal pans on it, while allowing the default vertical scroll behavior. I've put a transparent UIView over the scroll view, and added a pan gesture recognizer to it. This way I…
40
votes
3 answers

UIView animation based on UIPanGestureRecognizer velocity

I would like to be able to move a subview on and off the screen much like you browse between images in the iPhone's build in Photos app, so if the subview is more than 1/2 off screen when I let go with my finger it must animate off screen, but it…
24
votes
3 answers

Swipe to delete on CollectionView

I'm trying to replicate the swipe to delete functionality of iOS. I know it's instantly available on a tableview, but the UI that I need to build benefits from a Collection View. Therefor I need a custom implementation where I would be using a swipe…
user2023106
21
votes
3 answers

ios UIPanGestureRecognizer pointer position

UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(pan:)]; [self addGestureRecognizer:panRecognizer]; - (void)pan:(UIPanGestureRecognizer *)gesture { NSLog(@"%f", [gesture…
Jacksonkr
  • 29,242
  • 36
  • 164
  • 265
20
votes
7 answers

UIPanGestureRecognizer do something immediately when touched

I am new to ios, so I apologize in advance if I am missing something obvious. I am creating a puzzle where I would like the individual puzzle pieces to increase in size on touch and decrease on letting go. Currently I…
buczek
  • 1,979
  • 6
  • 27
  • 39
19
votes
7 answers

Combining a UILongPressGestureRecognizer with a UIPanGestureRecognizer

I d'like to combine a UILongPressGestureRecognizer with a UIPanGestureRecognizer. The UIPanGestureRecognizer should start with a long press. Is there a simple way to do this? or do I really have to write my own gesture recognizer? I wan't something…
18
votes
4 answers

Full swipe UITableViewCell to delete UITableView iOS 8

I'd like to mimic the swipe to delete function of a UITableViewCell just like the mail app in iOS 8. I'm not referring to swipe to reveal a delete button. I'm referring to when you swipe, it discoloses 3 actions, but if you keep swiping to the left,…
VaporwareWolf
  • 9,573
  • 8
  • 48
  • 78
18
votes
2 answers

Pan gesture translation being reset between should-begin and handler (with state began) on iOS7

I have a pan gesture recognizer to drag a panel up, down, left, or right. When the direction of the pan is not possible I don't allow the recognizer to begin so that the touches can go to other UI elements within the panel. However, on iOS7 the…
jhabbott
  • 16,761
  • 8
  • 56
  • 91
17
votes
2 answers

Prevent UIScrollView's UIPanGestureRecognizer from blocking UIScreenEdgePanGestureRecognizer

I have a UIScrollView that fills the screen on one page of my app, but I want to allow the user to pan from the edge of the screen to reveal a view behind it. The problem is that the UIScrollView steals the touches from my…
16
votes
3 answers

How to stop UIPanGestureRecognizer when object moved to certain frame

I have an object of image type which I am moving using UIPanGestureRecognizer, and I need to stop recognizing the UIPanGestureRecognizer when the object reaches a certain frame. UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer…
16
votes
3 answers

why is there a delay when moving object using UIPanGestureRecognizer

I'm moving UIView object using UIPanGestureRecognizer - how much I drag my finger on screen, that much I move the view in the same direction (only in X - left or right, Y is not changing). It works fine, but with (very noticeable) delay. Here is the…
Michael
  • 683
  • 6
  • 18
15
votes
2 answers

Handling scroll views with (custom, interactive) view controller presentation and dismissal

I have been experimenting with custom interactive view controller presentation and dismissal (using a combination of UIPresentationController, UIPercentDrivenInteractiveTransition, UIViewControllerAnimatedTransitioning, and…
Jeff C.
  • 2,376
  • 2
  • 14
  • 21
15
votes
4 answers

How can I detect the scroll direction from the UICollectionView?

I have a UICollectionView. I want to detect scroll direction. I have a two different animation style for scroll down and scroll up. So I must learn scroll direction. CGPoint scrollVelocity =…
14
votes
3 answers

Animate constraint change smoothly with pan gesture

How to animate constraint change smoothly with pan gesture in iOS? I am trying to develop a screen, where a view is at bottom of the screen. And I've added pan gesture to that view. On dragging that view I want change top constraint of that view.…
14
votes
3 answers

adding inertia to a UIPanGestureRecognizer

I am trying to move a sub view across the screen which works, but i also want to add inertia or momentum to the object. My UIPanGestureRecognizer code that i already have is below. Thanks in advance. UIPanGestureRecognizer *panGesture =…
MindBlower3
  • 495
  • 4
  • 16
1
2 3
69 70