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
88
votes
13 answers

UIImageView pinch zoom swift

I was hoping someone could help me out. I am trying to allow a user to pinch zoom on a UIImageView(with a max and min level allowed). But for some reason the it does not work right. The image zooms a little then just bounces back. Thank you. here is…
RandomBytes
  • 1,781
  • 1
  • 13
  • 14
33
votes
1 answer

Failed to receive system gesture state notification before next touch

I have a control that will switch two views alternatively in a view. ie, Two view controllers are added by sub view method in a container view. A pinch out gusture zooms in current view, and shows the second view. If wish to go to the previous view,…
32
votes
1 answer

Adding pinch zoom to a UICollectionView

Intro I'm going to describe the effect I want to achieve, and then I'll give detail on how I'm currently trying to implement this and what's wrong with its behaviour as it stands. I'll also mention another approach I've looked at but couldn't make…
21
votes
1 answer

Finding pinch-in or pinch-out in UIPinchGestureRecognizer

I'm using UIPinchGestureRecognizer on view, now I have a requirement of knowing whether pinch-in is performed or pinch-out is performed in my selector method. Either of 1 among at a time. Please give me some idea to obtain this. Thank you.
Kumaran
  • 687
  • 6
  • 14
19
votes
5 answers

Using PinchGesture; how can I zoom in to where a user's fingers actually "pinch"?

I've implemented the UIPinchGestureRecognizer on a UIImageView in my app, however no matter where I pinch on the image, it seems to zoom into the same spot. Does anyone know how I can make it zoom in to where a user actually "pinches"? See code…
Brittany
  • 1,359
  • 4
  • 24
  • 63
13
votes
2 answers

Scale image based off UIPinch

I am so confused with how to do what I need! Any help is very appreciated! I have an transparent image overlay that has another image behind it that has a UIPanGestureRecognizer and a UIPinchGestureRecognizer attached to it. The top image has a…
12
votes
1 answer

Swift 3: How do I pinch to scale and rotate UIImageView?

I am really struggling to find tutorials online as well as already answered questions (I have tried them and they don't seem to work). I have a UIImageView that I have in the centre of my view. I am currently able to tap and drag this wherever I…
Jimmy
  • 285
  • 3
  • 11
12
votes
3 answers

Scale of UIPinchGestureRecognizer in horizontal and vertical directions separately

When using UIPinchGestureRecognizer what is the best way to detect/read the pinch scale in horizontal and vertical directions individually? I saw this post UIPinchGestureRecognizer Scale view in different x and y directions but I noticed there were…
Dogahe
  • 1,380
  • 2
  • 20
  • 50
10
votes
1 answer

Pinch zoom shifting image to most left corner on iPad in iOS?

I have a image in iOS. I have added pinch gesture on the image when i pinch the image it shifted to top left corner. I have also added pan gesture on image. When an image is zoomed then i am scrolling the image in every direction for that purpose i…
TechChain
  • 8,404
  • 29
  • 103
  • 228
9
votes
1 answer

UIPinchGestureRecognizer. Make zoom in location of fingers, not only center

I'm able to use UIPinchGestureRecognizer for making zoom in the View of a UICollectionViewCell, but it doesn't matter the place where you start to make the UIPinch gesture, always the zoom goes in the center of the view. For example, I would like to…
santibernaldo
  • 825
  • 1
  • 11
  • 26
9
votes
5 answers

iOS: Scaling UITextView with pinching?

I'm interested in creating UITextView that is expanding dynamically while typing the text, and scaling as the user pinches the screen(Similar behaviour can be found in TinyPost). When you just type (without pinching) the textView expands fine. When…
8
votes
0 answers

Pinch to zoom for entire UICollectionView

I want my entire UICollectionView zoomable including all the items in it. I tried the delegate method func viewForZooming(in scrollView: UIScrollView) -> UIView? as UICollectionView falls under UIScrollView hierarchy. Unfortunately, this method…
8
votes
2 answers

UIScrollView on tvOS

The question is very simple, how to enable scroll and zoom inside a UIScrollView in tvOS? I tried the same initializer code from iOS and returned the scrollview for the focusedView var, but nothing happens when i touch the remote. Also, i tried to…
7
votes
3 answers

How to detect pinch in gesture vs pinch out gesture?

Instead of scaling, which I think pinch gesture is usually used for, I am looking to just detect whether the pinch was a pinch in vs pinch out so I can collapse or expand some table sections. How would I go about doing that?
6
votes
1 answer

Pinch Gesture in Swift Playground?

Initially I read you couldn't experiment with touches or gestures in a playground. Then I found that touchesMoved or a tap gesture would react. However, I now am testing a UIPinchGestureRecognizer. There isn't the feature that lets you simulate…
Alex Bollbach
  • 4,370
  • 9
  • 32
  • 80
1
2 3
16 17