Search code examples
iosipaduiscrollviewuiimageviewuiscrollviewdelegate

UIScrollView zooming in a fixed point, and disable the pinch in/out


i'm stuck on a problem with UIScrollView

i wanna the scroll view be zoomed when the user tap on a specific point, and prevent the user to zoom in/out using Pinch Zoom Gestures, how can i do it?

[imgScroll setDelegate:self];
float minimumScale = [imgScroll frame].size.height  / [imageView frame].size.height;
[imgScroll setMinimumZoomScale:minimumScale];
[imgScroll setZoomScale:minimumScale];

- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {
return [imageView viewWithTag:ZOOM_VIEW_TAG];}


- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale {
[scrollView setZoomScale:scale+0.01 animated:NO];
[scrollView setZoomScale:scale animated:NO];}

thx in advance.


Solution

  • I was disable the zoom propriety in the `UIScrollView, checked all the propriety under the touch section in Interface Builder.