[ACCEPTED]-Hide UISlider thumb image-uislider

Accepted answer
Score: 61

Much simpler:


[sli setThumbImage:[[[UIImage alloc] init] autorelease] forState:UIControlStateNormal];

Swift version

sli.setThumbImage(UIImage(), for: .normal)


Score: 16

The easiest way is simply setting the Thumb Tint 2 colour to Clear on the Interface Builder - like 1 so...

enter image description here


Score: 12

This is an old thread but I found it so 4 someone else may as well.

Here's a solution 3 to this in Swift. I'm creating a blank UIImage 2 here programatically and then assigning 1 it to the thumb.

    let rect = CGRect(x: 0, y: 0, width: 1, height: 1)
    UIGraphicsBeginImageContextWithOptions(CGSize(width: 1, height: 1), false, 0)
    if let blankImg = UIGraphicsGetImageFromCurrentImageContext() {
        slider.setThumbImage(blankImg, for: .normal)
Score: 1

One line solution:

[_slider setThumbImage:[UIImage new] forState:UIControlStateNormal];


Score: 0

I'd try subclassing UISlider and override -thumbRectForBounds:trackRect:value: to return 2 NSZeroRect. If that doesn't do it, try 1 overriding -thumbImageForState: to return nil.

More Related questions