Search This Blog

Loading...

Tuesday, June 22, 2010

Customize the default UISlider in iPhone

here is a simple way to customize the UISlider images

UIImage *stetchLeftTrack = [[UIImage imageNamed:@"left-slide.png"]
                                stretchableImageWithLeftCapWidth:10.0 topCapHeight:0.0];
    UIImage *stetchRightTrack = [[UIImage imageNamed:@"right-slide.png"]
                                 stretchableImageWithLeftCapWidth:10.0 topCapHeight:0.0];
    [sldDistanceFilter setThumbImage: [UIImage imageNamed:@"slider_ball.png"] forState:UIControlStateNormal];
    [sldDistanceFilter setMinimumTrackImage:stetchLeftTrack forState:UIControlStateNormal];
    [sldDistanceFilter setMaximumTrackImage:stetchRightTrack forState:UIControlStateNormal];

You just need to replace the image names according to your suite.

1 comment:

Anonymous said...

This is all useless without the 3 images. Does anyone have them?