I need to set minimum and and maximum value of pinch gesture from 0 to 1 in swift. Is there any way to do that?
Basically what i need is replacing slider into pinch gesture, I have a chart view in my app and there is a slider which is used to change value of chart. Similarly I want to implement pinch gesture instead of slider, More precisely the value must be change accordingly when pinching on the chart. Also I need to limit pinching range into 0 to 1 (Pinch scale).
What you are looking for is not easy to picture, but if you want to allow users to use pinch to zoom a view while keeping the zooming constrained to a minimum and maximum value, you could simply make use of a UIScrollView and make it zoomable, and put some other view inside of it to represent something that needs to be pinched.
For zooming you need to implement a UIScrollViewDelegate and implement
viewForZoomingInScrollView:, as explained in the UIScrollView documentation. Set the UIScrollView'sminimumZoomScaleandmaximumZoomScaleproperties to constrain it. The zoom scale will be within your minimum and maximum range, and you can then convert it to your slider-like value.