Does anyone have a quick way to make a UISlider that looks like the ones in the iPod app (think scrubber/volume control). Basically I need something that looks exactly like an MPVolumeView, but doesn't control sound. Failing that, does anyone have the assets to make one (the knob/track).
+1
A:
You should be able to approximate the appearance you want (wouldn't guarantee exact likeness) by using
setThumbImage:forState:
setMinimumTrackImage:forState:
setMaximumTrackImage:forState:
on UISlider. (It's also not very hard to create your own slider, by subclassing UIControl.)
Felixyz
2009-08-15 12:08:44
+3
A:
Yeah, I knew how to create the custom slider, I just wanted to know if anyone had the images already. I guess not, so I extracted my own.
For future reference, if anyone else needs to do this:
Gallery of assets below, http://img200.imageshack.us/gal.php?g=whiteslide.png
Download those images, and use this code to set it all up:
scrubberSlider.backgroundColor = [UIColor clearColor];
UIImage *stetchLeftTrack = [[UIImage imageNamed:@"blueTrack.png"]
stretchableImageWithLeftCapWidth:9.0 topCapHeight:0.0];
UIImage *stetchRightTrack = [[UIImage imageNamed:@"whiteTrack.png"]
stretchableImageWithLeftCapWidth:9.0 topCapHeight:0.0];
[scrubberSlider setThumbImage: [UIImage imageNamed:@"whiteSlide.png"] forState:UIControlStateNormal];
[scrubberSlider setMinimumTrackImage:stetchLeftTrack forState:UIControlStateNormal];
[scrubberSlider setMaximumTrackImage:stetchRightTrack forState:UIControlStateNormal];
Max
2009-08-15 22:39:03
Thanks for providing links to assets. Exactly what I was looking for. :)
paul_sns
2010-05-20 04:43:18