EFCircularSlider - How to avoid the slider, sliding past the maximum value set

181 Views Asked by At

I am using instances of EFCircular slider in my project. There are 6 sliders and each of them has a different maximum value. Once the slider reaches the maximum value, normally if we slide further, it goes back to the minimum value (0). But I want to restrict the slider to its maximum value, even if we further try to move the slider in clockwise direction. Same behaviour is expected when we try to move the slider in anticlockwise direction when its value is zero (0). It should not go back in the reverse direction.

Any pointers or help would be greatly appreciated.

1

There are 1 best solutions below

0
On

Just replace this method

-(BOOL) continueTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event {
    [super continueTrackingWithTouch:touch withEvent:event];

    CGPoint lastPoint = [touch locationInView:self];
    float  _currentValueTemp = [self valueFromAngle];
    if(_currentValueTemp <= 0.8 || _currentValueTemp >= _maximumValue){

        return YES;

    }
    [self moveHandle:lastPoint];
    [self sendActionsForControlEvents:UIControlEventValueChanged];

    return YES;
}