WorldDownTown/RangeSeekSlider

slider doesn't slide properly on view controller who is presented modally

Opened this issue · 7 comments

New Issue Checklist

  • Updated RangeSeekSlider to the latest version
  • Checked Gitter

Issue Description

Environment

I have the same issue with the latest version

I was using TTRangeSlider the version in objective-c and I had the same issue in the modal of iOS 13.

I was able to solve the problem blocking the gesture on the Range Slider

- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer {
    if([gestureRecognizer isKindOfClass:UIPanGestureRecognizer.class]){
        UIPanGestureRecognizer *gesture = (UIPanGestureRecognizer *)gestureRecognizer;
        CGPoint velocity = [gesture velocityInView:self];
        return fabs(velocity.y) > fabs(velocity.x);
    }
    return true;
}

I confirm that VittoriDavide's solution perfectly works, thanks a lot, here is the swift equivalent

open override func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool { if gestureRecognizer.isKind(of: UIPanGestureRecognizer.self) { let gesture = gestureRecognizer as! UIPanGestureRecognizer let velocity = gesture.velocity(in: self) return abs(velocity.y)>abs(velocity.x) } else { return true } }

This is to place inside class RangeSeekSlider defnition

Trying the swift version above and it hasn't solved the issue for me on a modal.

To confirm @NRJMons - you added this inside the below within RangeSeekSlider.swift ?

@IBDesignable open class RangeSeekSlider: UIControl {

Another solution is to not use it in IB but add it programmatically. It works then.

I added

    open override func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
        if gestureRecognizer.isKind(of: UIPanGestureRecognizer.self) {
            let gesture = gestureRecognizer as! UIPanGestureRecognizer
            let velocity = gesture.velocity(in: self)
            return abs(velocity.y)>abs(velocity.x)
        } else {
            return true
        }
    }

in RangeSeekSlider.swift and it worked for me

I am still facing this issue by following above solutions.