I am trying to create a UISlider without the thumb image.
How can I do this, this is my code so far:
UISlider *sli = [[UISlider alloc] initWithFrame:progressView.frame]; [sli setThumbImage:nil forState:UIControlStateNormal]; [sli setBackgroundColor:[UIColor clearColor]]; [sli setMinimumTrackImage:[[UIImage imageNamed:@"ProgressBlueCap.png"] stretchableImageWithLeftCapWidth:10.0 topCapHeight:0.0] forState:UIControlStateNormal]; [sli setMaximumTrackImage:[[UIImage imageNamed:@"ProgressBlueCapRight.png"] stretchableImageWithLeftCapWidth:10.0 topCapHeight:0.0] forState:UIControlStateNormal];
Objc
[sli setThumbImage:[[[UIImage alloc] init] autorelease] forState:UIControlStateNormal];
Swift version
sli.setThumbImage(UIImage(), for: .normal)
The easiest way is simply setting the Thumb Tint colour to Clear on the Interface Builder - like so...
Voila!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With