Pritam Salunkhe
Pritam Salunkhe

Reputation: 97

Add UIGestureRecognizer with UIScrollView in iOS

I have ScrollView on my screen and also have two sliders on the scroll view.The problem is that my scrollview is recognizing gesture properly but slider gives me gesture trouble while moving.

So to detect the gestures of slider I have tried following gestureRecognizer method but still it is not working:

-(BOOL)gestureRecognizer:(UIPanGestureRecognizer *)gestureRecognizer
shouldRecognizeSimultaneouslyWithGestureRecognizer:         (UISwipeGestureRecognizer *)otherGestureRecognizer
{
    return YES;
}

Upvotes: 1

Views: 254

Answers (1)

Avijit Nagare
Avijit Nagare

Reputation: 8782

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

Upvotes: 1

Related Questions