Customize UISlider (track image height)

user997128 picture user997128 · Nov 4, 2011 · Viewed 28.9k times · Source

I'm customizing a UISlider. I could set a custom thumb image that is higher than the usual thumb however I could not make the track higher when setting a higher minimum track image but the track height remained the same. It should be possible as in the iPod/Music App on the iPad the volume slider is also higher as the usual slider as you can see here:


(source: cocoia.com)

Answer

antalkerekes picture antalkerekes · Feb 15, 2012

You need to subclass the slider and override the trackRectForBounds: method, like this:

- (CGRect)trackRectForBounds:(CGRect)bounds
{
    return bounds;
}