Thumb image does not move to the edge even when it\'s value is max or min.
Does anyone know how to make it move all the way to the edge of the slider?
I have created the similar slider by subclassing UISlider. In storyboard you can set a height constraint to increase height at runtime if slider thumb not gets touch events.
static float const SLIDER_OFFSET = 10.0;
//Get thumb rect for larger track rect than actual to move slider to edges
-(CGRect)thumbRectForBounds:(CGRect)bounds trackRect:(CGRect)rect value:(float)value {
UIImage *image = self.currentThumbImage;
rect.origin.x -= SLIDER_OFFSET;
rect.size.width += (SLIDER_OFFSET*2);
CGRect thumbRect = [super thumbRectForBounds:bounds trackRect:rect value:value];
return CGRectMake(thumbRect.origin.x, rect.origin.y+2, image.size.width, image.size.height);
}
//Make track rect smaller than bounds
-(CGRect)trackRectForBounds:(CGRect)bounds {
bounds.origin.x += SLIDER_OFFSET;
bounds.size.width -= (SLIDER_OFFSET*2);
CGRect trackRect = [super trackRectForBounds:bounds];
return CGRectMake(trackRect.origin.x, trackRect.origin.y, trackRect.size.width, trackRect.size.height);
}