开发者

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.

  1. Black image is leftside.png

  2. White image is rightside.png

  3. Black Circle is imgSlider.png

How to show images to the extreme end of the UISlider?

How to show images to the extreme end of the UISlider?

How to show images to the extreme end of the UISlider?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜