tags:

views:

12

answers:

0

I have a UISlider subclass that is supposed to implement a custom look. I'm doing this with stretchable images:

UIImage*    sliderBar = [UIImage imageNamed: @"SliderLeft.png"];
UIImage*    sliderLeft = [sliderBar stretchableImageWithLeftCapWidth: 7 topCapHeight: 0];
sliderBar = [UIImage imageNamed: @"SliderRight.png"];
UIImage*    sliderRight = [sliderBar stretchableImageWithLeftCapWidth: 1 topCapHeight: 0];
UIImage*    sliderRing = [UIImage imageNamed: @"SliderRing.png"];
UIImage*    sliderRingH = [UIImage imageNamed: @"SliderRing-Highlighted.png"];

[self setMinimumTrackImage: sliderLeft forState: UIControlStateNormal];
[self setMaximumTrackImage: sliderRight forState: UIControlStateNormal];
[self setThumbImage: sliderRing forState: UIControlStateNormal];
[self setThumbImage: sliderRingH forState: UIControlStateHighlighted];

This works fine on a device running 3.1.3. However, on an iPad (3.2.x) or iOS 4.x device, it looks like it's stretching the rightmost pixels, and never drawing the endcap.

SliderLeft.png is 8 pixels wide (there is no right endcap), SliderRight.png is 11 px.

I'm not seeing that anything here changed in UIImage or UISlider.

Are there any known gotchas here? Like I said, it was all working when I wrote it, but newer OSes seem to break it.