7

I've created a slider track that is draw on the actual background of my app and I've also drawn the UISlider thumb image. I know how to set the thumb image for the slider. But how do I hide the UISlider track?

Christian Gossain
  • 5,942
  • 12
  • 53
  • 85
  • possible duplicate of [How to make UISlider's "track" invisible?](http://stackoverflow.com/questions/4150903/how-to-make-uisliders-track-invisible) – OrangeDog Aug 18 '15 at 12:44

4 Answers4

24

If you do not want to use transparent images, you can just set the track images to empty UIImage objects:

[slider setMinimumTrackImage:[UIImage alloc] forState:UIControlStateNormal];
[slider setMaximumTrackImage:[UIImage alloc] forState:UIControlStateNormal];
Avario
  • 4,655
  • 3
  • 26
  • 19
  • I realize this is a separate question, but are there any potential repercussions from not calling init on those images? – livingtech Jun 06 '13 at 19:39
  • 1
    There should be no repercussions of not using init. The init method usually just sets default properties of an object, which are not required for UIImage. However, using [[UIImage alloc] init] or [UIImage new] will have the same effect in this case. – Avario Jun 07 '13 at 01:24
9

Use a 1px transparent image for the min and max track images. I answered this very same question yesterday.

Community
  • 1
  • 1
Justin
  • 20,509
  • 6
  • 47
  • 58
1

From Story Board :-

select clear color for Min Track and Max Track

enter image description here

Bijender Singh Shekhawat
  • 3,934
  • 2
  • 30
  • 36
0

Easy One :

[_slider setThumbImage:[UIImage new] forState:UIControlStateNormal];
itsji10dra
  • 4,603
  • 3
  • 39
  • 59