views:

36

answers:

1

Hello,

I have a custom slider bar and when I slide it back and forth the track image seems to move left and right a little. Anyone know why this happens?

UIImage *stetchLeftTrack = [[UIImage imageNamed:highBar] stretchableImageWithLeftCapWidth:capLeft topCapHeight:0.0];
UIImage *stetchRightTrack = [[UIImage imageNamed:grooveBar] stretchableImageWithLeftCapWidth:capRight topCapHeight:0.0];
[customSlider setThumbImage: [UIImage imageNamed:thb] forState:UIControlStateNormal];
[customSlider setThumbImage: [UIImage imageNamed:thbH] forState:UIControlStateHighlighted];
[customSlider setMinimumTrackImage:stetchLeftTrack forState:UIControlStateNormal];
[customSlider setMaximumTrackImage:stetchRightTrack forState:UIControlStateNormal];
+1  A: 

Is it possible that your capLeft and capRight values are not what you expect (they should probably be nonzero integers)? It could be stretching the entire image rather than just the part you intend to have stretched.

Frank Schmitt
It's 40 and 1, which doesn't seem right. What values should it be? do I need to use stretchableImage?
wolffang