uipinchgesturerecognizer

UIPinchGestureRecognizer only for pinching out

一个人想着一个人 提交于 2019-12-12 04:37:17
问题 I'm trying to create a UIPinchGestureRecognizer that fails if the user pinches out (moves there fingers apart). I know there is a really easy way to do this by just taking the scale of t he recogniser in the action method and if it is larger than 1, set a flag and ignore all the future calls. However, this does not work for me, I have other gesture recognisers that require this pinch recogniser to fail, so I need it to fail properly when the user pinches in the wrong direction. I have

UIPinchGestureRecognizer selector not getting called on UIImageView

人走茶凉 提交于 2019-12-11 17:38:00
问题 I've been trying to figure this out for hours, completely at a loss here. I'm trying to implement a UIPinchGestureRecognizer for some of the custom UIImageViews in my game, but it doesn't work. Everything thing I've researched says it should work, yet it doesn't. Pinch works fine if I add it to my view controller, or to a custom UIView, but not the UIImageViews. I've tried all the common fixes and tweaks, to no success. I have userInteractionEnabled and multipleTouchEnabled set to YES. I have

Resize font along with frame of label using pinch gesture on UILabel?

℡╲_俬逩灬. 提交于 2019-12-11 06:41:50
问题 Increase or decrease font size smoothly whenever user resize label using pinch gesture on it. Note Without compromising quality of font Not only transforming the scale of UILabel With support of multiline text Rotation gesture should work proper with pinch gesture Reference: SnapChat or Instagram Text Editor tool extension String { func height(withConstrainedWidth width: CGFloat, font: UIFont) -> CGFloat { let constraintRect = CGSize(width: width, height: .greatestFiniteMagnitude) let

Pinch gesture scale resetting to 1?

梦想的初衷 提交于 2019-12-10 10:56:23
问题 I was looking at this repo https://github.com/mmohsin991/gestures/blob/master/gestures/ViewController.swift and this example http://www.raywenderlich.com/50398/opengl-es-transformations-gestures I have the following code @IBOutlet var pinchProperty: UIPinchGestureRecognizer! @IBAction func pinchAction(sender: UIPinchGestureRecognizer) { if(dbg){println("scale \(pinchProperty.scale)")} let pinch: CGFloat = pinchProperty.scale switch pinchProperty.state{ case .Began: println("pinch started")

Convert PinchRecognizer Objective-C code to Swift

与世无争的帅哥 提交于 2019-12-08 10:45:27
问题 I am trying to translate the Objective-C code to Swift, can someone help. I am stuck on one line. Objective-C -(void)pinchDetected:(UIPinchGestureRecognizer *)pinchRecognizer { if([pinchRecognizer state] == UIGestureRecognizerStateBegan) { // Reset the last scale, necessary if there are multiple objects with different scales lastScale = [pinchRecognizer scale]; } if ([pinchRecognizer state] == UIGestureRecognizerStateBegan ||[pinchRecognizer state] == UIGestureRecognizerStateChanged) { ###I

Is there a gesture recognizer that handles both pinch and pan together?

主宰稳场 提交于 2019-12-07 09:33:56
问题 So I am working with the iOS 4.2 to add zoom and pan to my application. I have implemented an instance of the UIPinchGestureRecognizer and UIPanGestureRecognizer. It seems to me that only one of these is recognizing a gesture at a time. In particular, the latter only reacts when one finger is down, while the former reacts when the second finger is present. That is okay, but it has some side effects that I think make for inferior quality of user experience. When you put two fingers down and

How to reduce velocity of pinch-zoom UIGestureRecognizer

老子叫甜甜 提交于 2019-12-07 08:12:35
问题 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

Pinch gesture scale resetting to 1?

浪尽此生 提交于 2019-12-06 06:11:41
I was looking at this repo https://github.com/mmohsin991/gestures/blob/master/gestures/ViewController.swift and this example http://www.raywenderlich.com/50398/opengl-es-transformations-gestures I have the following code @IBOutlet var pinchProperty: UIPinchGestureRecognizer! @IBAction func pinchAction(sender: UIPinchGestureRecognizer) { if(dbg){println("scale \(pinchProperty.scale)")} let pinch: CGFloat = pinchProperty.scale switch pinchProperty.state{ case .Began: println("pinch started") case .Changed: geometryNodeMain.scale = SCNVector3(x:Float(pinch),y:Float(pinch),z:Float(pinch)) case

How to set minimum and maximum zoom scale using UIPinchGestureRecognizer

混江龙づ霸主 提交于 2019-12-06 03:52:28
问题 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

Is there a gesture recognizer that handles both pinch and pan together?

半世苍凉 提交于 2019-12-05 17:10:17
So I am working with the iOS 4.2 to add zoom and pan to my application. I have implemented an instance of the UIPinchGestureRecognizer and UIPanGestureRecognizer. It seems to me that only one of these is recognizing a gesture at a time. In particular, the latter only reacts when one finger is down, while the former reacts when the second finger is present. That is okay, but it has some side effects that I think make for inferior quality of user experience. When you put two fingers down and then move one of them, the image expands (zooms in) like it should, but the pixels under the fingers are