Question

I have a view with UIPanGestureRecognizer and UISegmentedControl.

Segmented control has different styles for highlighted and selected state.

The problem is when I start pan gesture inside UISegmentedControl then it sometimes stays highlighted, but should be with selected style.

I tried to disable it when the touch is inside some area, but sometimes it still works.

How to solve this issue? It is clearly seen when segmented control has for example different font colors for highlighted and selected states.

Was it helpful?

Solution

I think you should use this method to prevent touch on specific controls:(for example:)

- (BOOL) gestureRecognizer: (UIGestureRecognizer *) gestureRecognizer
       shouldReceiveTouch:(UITouch *)touch
{
    if (touch.view == sliderButton)
    {
        return NO;
    }
    return YES;
}

You can replace 'sliderButton' with your segment control or whichever view you want.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top