0

我有一个自定义滑块,当我来回滑动它时,轨道图像似乎会左右移动一点。有谁知道为什么会这样?

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];
4

1 回答 1

1

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.

于 2009-12-17T22:00:26.470 回答