WorldDownTown / RangeSeekSlider

RangeSeedSlider provides a customizable range slider like a UISlider.
MIT License
755 stars 282 forks source link

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

Open buhnad opened 4 years ago

buhnad commented 4 years ago

New Issue Checklist

Issue Description

Environment

phongnn9x commented 4 years ago

I have the same issue with the latest version

VittoriDavide commented 4 years ago

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;
}
NRJMons commented 4 years ago

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

SteveBlackUK commented 4 years ago

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 {

philosopherdog commented 3 years ago

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

r3econ commented 3 years ago

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

PatilManoj1717 commented 2 years ago

I am still facing this issue by following above solutions.