문제

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.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top