I have to place a slider and want to place an imge on slider. the slider i want is this
CAn any body help me?
I have to place a slider and want to place an imge on slider. the slider i want is this
CAn any body help me?
See the UISlider class reference. You want to set setThumbImage:forState:
as well as setMinimumTrackImage:forState:
and setMaximumTrackImage:forState:
. Use the same images for the minimum and maximum track images, and use UIControlStateNormal
for the state.
Below code will be in ViewWillAppear...
-(void)viewWillAppear:(BOOL)animated
{
slider.backgroundColor = [UIColor clearColor];
UIImage *stetchLeftTrack = [[UIImage imageNamed:@"yellowslide.png"]
stretchableImageWithLeftCapWidth:10.0 topCapHeight:0.0];
UIImage *stetchRightTrack = [[UIImage imageNamed:@"yellowslide.png"]
stretchableImageWithLeftCapWidth:10.0 topCapHeight:0.0];
[slider setThumbImage: [UIImage imageNamed:@"1.PNG"] forState:UIControlStateNormal];
[slider setMinimumTrackImage:stetchLeftTrack forState:UIControlStateNormal];
[slider setMaximumTrackImage:stetchRightTrack forState:UIControlStateNormal];
slider.minimumValue = 1.0;
slider.maximumValue = 3.0;
slider.continuous = YES;
slider.value = 0.0;
}