Change the click trigger of a UISegmentedControl within a UIScrollView

0

I need to change the trigger of a UISegmentedControl , since I have a form, with several UISegmentedControl , contained in a UIScrollView and when I do scrolling by touching a UISegmentedControl it selects one of the values.

I wish it was not selected. Can you change this behavior? Can UISegmentedControl be able to check if I'm descending, moving up or pressing the screen so the element is not selected?

    
asked by anonymous 23.04.2014 / 21:36

1 answer

0

Well, theoretically it should not select if you are performing a scrolling move on your UIScrollView . First of all, make sure UISegmentedControl is really inside UIScrollView and not below or above.

Another thing you can do to try to solve this problem, which will work depending on the general scenario of your UIViewController , is to set the exclusiveTouch property from UISegmentedControl to NO . In this way the touch will also be passed to the UIScrollView that will continue allowing the scrolling movement.

If none of this works for you, one solution that can be used is to disable UISegmentedControl while UIScrollView is being moved. To apply such a solution you need to sign the delegate of UIScrollView ( UIScrollViewDelegate ) and implement the desired methods (start and end of scrolling). Just set the enabled property of UIScrollView to YES and NO within each delegate callback.

    
24.04.2014 / 04:00