How to show images to the extreme end of the UISlider?
I'm implementing UISlider. I want to show images to the extreme end of the slider(eg. volume control images of mute and full sound). I'm using
UIImage *maximumValueImage = [UIImage imageNamed:@"speaker_plus.png"];
UIImage *minimumValueImage = [UIImage imageNamed:@"speaker_minus.png"];
slider.maximumValueI开发者_运维技巧mage = maximumValueImage;
slider.minimumValueImage = minimumValueImage;
How to implement the following method?
-(CGRect)maximumValueImageRectForBounds:(CGRect)bounds; -(CGRect)minimumValueImageRectForBounds:(CGRect)bounds;
I did same for one of my app. Below is code.
UIImage *stetchLeftTrack = [[UIImage imageNamed:@"leftslide.png"]
stretchableImageWithLeftCapWidth:10.0 topCapHeight:0.0];
UIImage *stetchRightTrack = [[UIImage imageNamed:@"rightslide.png"]
stretchableImageWithLeftCapWidth:10.0 topCapHeight:0.0];
[slider setThumbImage:[UIImage imageNamed:@"imgSlider.png"] forState:UIControlStateNormal];
[slider setMinimumTrackImage:stetchLeftTrack forState:UIControlStateNormal];
[slider setMaximumTrackImage:stetchRightTrack forState:UIControlStateNormal];
Hope this Help.
These are the images I used.
Black image is leftside.png
White image is rightside.png
Black Circle is imgSlider.png
精彩评论