Thursday, 28 April 2011

Change UISlider Image in Iphone


There are three images in UISlider you can change

1) left (default blue)
2) right (default white)
3) thumb (default white circle)


UIImage *sliderLeftTrackImage = [[UIImage imageNamed: @"SliderMin.png"] stretchableImageWithLeftCapWidth: 9 topCapHeight: 0];

UIImage *sliderRightTrackImage = [[UIImage imageNamed: @"SliderMax.png"] stretchableImageWithLeftCapWidth: 9 topCapHeight: 0];

1)
[mySlider setMinimumTrackImage: sliderLeftTrackImage forState: UIControlStateNormal];

2)
[mySlider setMaximumTrackImage: sliderRightTrackImage forState: UIControlStateNormal];

3)
[mySlider setThumbImage:[UIImage imageNamed:@"thumb_image.png"] forState:UIControlStateNormal];

No comments:

Post a Comment