uipinchgesturerecognizer

How to reduce velocity of pinch-zoom UIGestureRecognizer

落爺英雄遲暮 提交于 2019-12-05 13:15:27
I've created a UIGestureRecognizer much like this one : - (void)handlePinchGesture:(UIPinchGestureRecognizer *)gestureRecognizer { if([gestureRecognizer state] == UIGestureRecognizerStateBegan) { // Reset the last scale, necessary if there are multiple objects with different scales lastScale = [gestureRecognizer scale]; } if ([gestureRecognizer state] == UIGestureRecognizerStateBegan || [gestureRecognizer state] == UIGestureRecognizerStateChanged) { CGFloat currentScale = [[[gestureRecognizer view].layer valueForKeyPath:@"transform.scale"] floatValue]; // Constants to adjust the max/min values

How to set minimum and maximum zoom scale using UIPinchGestureRecognizer

耗尽温柔 提交于 2019-12-04 07:34:14
I want to zoom in and zoom out an image view and i dont want to use UIScrollView for that. so for this i used UIPinchGestureRecognizer and here is my code - [recognizer view].transform = CGAffineTransformScale([[recognizer view] transform], [recognizer scale], [recognizer scale]); recognizer.scale = 1; this is working fine for zoom in and zoom out. But problem is that i want to zoom in and zoom out in specific scale like in UIScrollView we can set the maxZoom and minZoom. i could not found any solution for that, every tutorial about UIPinchGestureRecognizer just describe the same code. nhahtdh

Use UIPinchGestureRecognizer to scale view in direction of pinch [closed]

限于喜欢 提交于 2019-12-03 21:06:15
I needed a Pinch Recognizer that would scale in x, or y, or both directions depending on the direction of the pinch. I looked through many of the of the other questions here and they only had parts of the answer. Here's my complete solution that uses a custom UIPinchGestureRecognizer. I created a custom version of a UIPinchGestureRecognizer. It uses the slope of line between the two fingers to determine the direction of the scale. It does 3 types: Vertical; Horizontal; and Combined(diagonal). Please see my notes at the bottom. -(void) scaleTheView:(UIPinchGestureRecognizer *)pinchRecognizer {

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

青春壹個敷衍的年華 提交于 2019-12-03 07:28:26
问题 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 below. ViewController.m - (IBAction)scaleImage:(UIPinchGestureRecognizer *)recognizer { recognizer.view.transform = CGAffineTransformScale(recognizer.view.transform, recognizer.scale, recognizer.scale); recognizer.scale = 1; } - (BOOL)gestureRecognizer

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

时光怂恿深爱的人放手 提交于 2019-11-30 19:03:48
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 want on screen. I want to be able to pinch to scale and rotate this view. How do I achieve this? I have tried the code for rotation below but it doesn't seem to work? Any help will be a massive help and marked as answer. Thank you guys. import UIKit class DraggableImage: UIImageView { override func touchesBegan(_ touches: Set<UITouch>, with event:

Zoom on a two dimensional UICollectionView

六眼飞鱼酱① 提交于 2019-11-30 16:11:25
问题 I created a UICollectionView which is horizontal and vertically. It has different UICollectionViewCells . Everything is layouted correctly. Now I am trying to make it zoomable . The UICollectionViewCells are resized correctly too. Every time the UIPinchGesture occures, I set the itemSize inside the UICollectionViewLayout dependend on the scale . TestLayout *layout = (TestLayout *) self.collectionViewLayout; CGSize newItemSize = CGSizeMake(_sizeItem.width * gesture.scale, _sizeItem.height *

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

微笑、不失礼 提交于 2019-11-29 18:32:18
问题 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 want on screen. I want to be able to pinch to scale and rotate this view. How do I achieve this? I have tried the code for rotation below but it doesn't seem to work? Any help will be a massive help and marked as answer. Thank you guys. import UIKit

iOS: Scaling UITextView with pinching?

ぐ巨炮叔叔 提交于 2019-11-27 19:11:57
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 you just pinch (without typing) is works fine, but when you pinch and then type, the text inside gets cut. Here is my code: UIPinchGestureRecognizer *pinchGestRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(scaleTextView:)]; pinchGestRecognizer.delegate = self; [bgFrameImageView addGestureRecognizer

UIImageView pinch zoom swift

一曲冷凌霜 提交于 2019-11-27 00:17:51
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 the zoom func func zoom(sender:UIPinchGestureRecognizer) { if sender.state == .Ended || sender.state == .Changed { let currentScale = self.view.frame.size.width / self.view.bounds.size.width var newScale = currentScale*sender.scale if newScale < 1 { newScale = 1 } if newScale > 9 { newScale = 9 } let transform = CGAffineTransformMakeScale(newScale,

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

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-26 23:04:08
问题 This question already has an answer here: UIPinchGestureRecognizer position the pinched view between the two fingers 2 answers 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 make pinch in the upper-left area of the view, and the zoom have to be created in the position where I touch the screen