[ACCEPTED]-Hide UISlider thumb image-uislider
Accepted answer
Much simpler:
Objc
[sli setThumbImage:[[[UIImage alloc] init] autorelease] forState:UIControlStateNormal];
Swift version
sli.setThumbImage(UIImage(), for: .normal)
0
The easiest way is simply setting the Thumb Tint 2 colour to Clear on the Interface Builder - like 1 so...
Voila!
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)
UIColor.clear.setFill()
UIRectFill(rect)
if let blankImg = UIGraphicsGetImageFromCurrentImageContext() {
slider.setThumbImage(blankImg, for: .normal)
}
UIGraphicsEndImageContext()
One line solution:
[_slider setThumbImage:[UIImage new] forState:UIControlStateNormal];
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.
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.