Questions tagged [uipinchgesturerecognizer]

UIPinchGestureRecognizer is a concrete subclass of UIGestureRecognizer that looks for pinching gestures involving two touches.

When the user moves the two fingers toward each other, the conventional meaning is zoom-out; when the user moves the two fingers away from each other, the conventional meaning is zoom-in.

Pinching is a continuous gesture. The gesture begins (UIGestureRecognizerStateBegan) when the two touches have moved enough to be considered a pinch gesture. The gesture changes (UIGestureRecognizerStateChanged) when a finger moves (with both fingers remaining pressed). The gesture ends (UIGestureRecognizerStateEnded) when both fingers lift from the view.

Whole document - UIPinchGestureRecognizer

248 questions
1
vote
0 answers

How to increase and decrease width and height of a UIView independently in swift?

I have a view, which i want to be resized as user wants, means user can increase or decrease height or width of UIView independently. I have tried using pinch gesture but it works with width and height together. I have implemented pan gesture on…
1
vote
2 answers

avoid three finger pinching in UIPinchGestureRecognizer in swift

According to apple documentation pinching is a continuous gesture & mean to be use with two fingers. Even with three finger pinching it seems working fine in swift 4.1. I tried to print number of touches. Even with three fingers it gives number of…
1
vote
0 answers

how to use the animator behaviours and Gestures for the same objects at a time in iOS swift?

I have added PINCH,PAN,ROTATE Gesture for some objects. Due to the animator’s behaviours I could not Pinch,Pan and Rotate the objects. If I remove the animator behaviour’s such as gravity , boundaries, elasticity and snap then the gestures mentioned…
PvDev
  • 791
  • 21
  • 67
1
vote
1 answer

Resizing UILabel using UIPinchGestureRecognizer has stopped working

This code used to work and cause a square UILabel, that has a border with corner radius set to half the length of the side (i.e. it looks like a circle), to re-size when pinched: - (void)resizeTargetRegistrationShape:(UIPinchGestureRecognizer…
Nick
  • 4,820
  • 18
  • 31
  • 47
1
vote
1 answer

Unproblematic use of UIPinchGestureRecognizer with UILongTapGestureRecognizer

I need to use a UILongTapGestureRecognizer with a UIPinchGestureRecognizer simultaneously. Unfortunately, the first touch of the UILongTapGestureRecognizer will be counted for the PinchGestureRecognizer too. So when holding…
1
vote
2 answers

How do I alter the touch location when handling a pinch and a pan gesture recognizer at the same time?

I'm trying to recreate an interaction similar to the photos app where you can pinch and pan a photo at the same time. Adding or removing a touch mid pan works perfectly. In my code I'm using the location of touch to move the view. When I drag with…
1
vote
2 answers

limit UIPinchGestureRecognizer to work with exactly two fingers only

I have found no way in the documentation on how to specify the number of touches for UIPinchGestureRecognizer or UIRotationGestureRecognizer. All I found anywhere is that it only works with two fingers, but by my experiments, it also works with 3 or…
user4081361
1
vote
1 answer

Get original image size after UIPinchGestureRecognizer pinch in and out

I would like to return the original image size after I use pinch gesture to zoom in or out. What I have found the similar answer is How to get original image when we zoom in and zoom out the image in ios, it uses scrollView. Not exactly what I…
HungCLo
  • 442
  • 2
  • 6
  • 21
1
vote
2 answers

Determining direction of UIPinchGestureRecognizer (without slope)

I'm using a UIPinchGestureRecognizer to resize the frames of views in my app. I'd like to resize height and width independently (the views are rectangles on a snap-to grid), and so I need to determine whether the pinch is intended to modify the…
c_booth
  • 2,185
  • 1
  • 13
  • 22
1
vote
1 answer

Text gets cut off when pinching/scaling/resizing UITtextView

I have a UITextView that can be scaled, rotated and resized using gestures inside a UIImageView. When I scale or resize it and then type in some text, the text container changes size and the text gets cut off. I tried changing the size of the text…
1
vote
0 answers

Image erasing and drawing on pinch gesture weird issue

here I am creating UIImageview programatically and give its frame according to UIImage. I am using UIPinchGestureRecogniser for zooming image. here are my class. Here is the url for image :…
1
vote
2 answers

pinch gesture recognizer on expanded image

I have added a tap gesture recognizer action to my image view. Once the image is tapped it expands to full screen and then dismisses full screen once tapped again. How would I add pinch to zoom to the image after it is already expanded. Here is my…
Step Step
  • 97
  • 1
  • 12
1
vote
1 answer

Scaling uivew scales its subview issue

i am having a container view with imageview and circleView with circle shape, on pinch gesture i want to scale imageview not the circleView with circle shape. Below is my code if(gestureRecognizer.state == .began || gestureRecognizer.state ==…
1
vote
1 answer

Resizing a view in two directions?

In Swift I have a question. I know how to resize views in general using gestures but what I'm trying to do is have the user scale the rectangular view in two different directions. If I'm trying to increase the width of the rectangle I pinch left and…
1
vote
0 answers

Can't get shouldRecognizeSimultaneouslyWithGestureRecognizer working

I'm working with Swift 3, Xcode and SpriteKit. I have two gestures: UIPanGestureRecognizer and UIPinchGestureRecognizer let pinchGesture = UIPinchGestureRecognizer() let panGesture = UIPanGestureRecognizer() override func didMove(to view: SKView) {…