UIScrollView and cancel a zooming pinch gesture?

To prevent user-controller zooming and panning but still allow programmatic zooming and panning of a scrollview, the best approach is to override the UIScrollView's - addGestureRecognizer : method in a subclass.

Up vote 1 down vote favorite share g+ share fb share tw.

Ios uiscrollview link|improve this question asked Jun 4 '11 at 5:29SK92,38121834 75% accept rate.

To prevent user-controller zooming and panning but still allow programmatic zooming and panning of a scrollview, the best approach is to override the UIScrollView's -addGestureRecognizer: method in a subclass. -(void)addGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer { //Prevent any of the default panning and zooming controls from working gestureRecognizer. Enabled = NO; super addGestureRecognizer:gestureRecognizer; return; } Each gesture recognizer is simply disabled, for finer control (for ex.

Allowing the pan control but only allow zooming via a double tap for instance) you'd simply check the incoming gesture recognizer via -isKindOfClass: and disabling as appropriate. -(void)addGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer { //Prevent zooming but not panning if (gestureRecognizer isKindOfClass:UIPinchGestureRecognizer class) { gestureRecognizer. Enabled = NO; } super addGestureRecognizer:gestureRecognizer; return; } Hope this helps.

How's this: -(void)handlePinchGesture:(UIPinchGestureRecognizer *)sender { if (!sender isEnabled) { sender setEnabled:YES; } if (sender. State == UIGestureRecognizerStateChanged) { if (sender. Scale > 2.0) { NSLog(@"Upper bound reached"); sender setEnabled:NO; } else if (sender.

Scale.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions