3

How can i restrict the pinching effect only on X-axis. ?

I've created a ScrollView and added an image into it . I've already done the pinch zoom effect for the UIImageView but i want to restrict the zoom only on X-axis.

swathy krishnan
  • 916
  • 9
  • 22
  • check this thread : http://stackoverflow.com/questions/1423119/uiview-how-do-i-constrain-scaling-to-one-dimension-only – Jad Feitrouni Feb 04 '15 at 13:29
  • I've created a color picker and i want to pinch zoom it along x-axis to make the color gradient selection much more easier . How can i do it ? – swathy krishnan Feb 06 '15 at 04:09
  • I actually want to pinch zoom the color picker view of the below project . Precisely speaking I want to zoom the Inf Color Bar Picker View in the xib file. And I want to restrict the picker view within the current frame and to pinch zoom only on X-Axis. https://www.dropbox.com/s/x5ivu3jrb18tx9m/InfColorPicker-master.zip?dl=0 – swathy krishnan Feb 06 '15 at 11:07

1 Answers1

0

Try this :

1. Use UIScrollViewDelegate
2. Implement this function

-(void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    if (scrollView.contentOffset.x > 0)
        scrollView.pinchGestureRecognizer.enabled = YES;
    else
        scrollView.pinchGestureRecognizer.enabled = NO; 
}
Nitish
  • 13,845
  • 28
  • 135
  • 263
  • I've created a color picker and i want to pinch zoom it along x-axis to make the color gradient selection much more easier . How can i do it ? – swathy krishnan Feb 06 '15 at 04:08