RangeSeekSlider icon indicating copy to clipboard operation
RangeSeekSlider copied to clipboard

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

Open buhnad opened this issue 4 years ago • 7 comments

New Issue Checklist

  • [ ] Updated RangeSeekSlider to the latest version
  • [ ] Checked Gitter

Issue Description

Environment

buhnad avatar Apr 09 '20 00:04 buhnad

I have the same issue with the latest version

phongnn9x avatar Apr 16 '20 06:04 phongnn9x

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;
}

VittoriDavide avatar May 11 '20 16:05 VittoriDavide

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

NRJMons avatar Jun 20 '20 13:06 NRJMons

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 {

SteveBlackUK avatar Jul 23 '20 22:07 SteveBlackUK

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

philosopherdog avatar Nov 26 '20 00:11 philosopherdog

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

r3econ avatar Oct 06 '21 15:10 r3econ

I am still facing this issue by following above solutions.

PatilManoj1717 avatar Feb 10 '22 14:02 PatilManoj1717