大家好,我有一个自定义图像来替换UISLider defult按钮图像,所有工作正常的图像显示,它不会被剪掉。问题是,当我使用滑块上下移动图像消失时,有些如何有时不再出现。有人可以解决吗?
CGRect rect = CGRectMake(16.0, 390.0, 297.0, 35.0);
slider.frame = rect;
UIImage* thumbImage = [UIImage imageNamed:@"thumb.png"];
[slider setThumbImage:thumbImage forState:UIControlStateNormal];
UIImage* leftImage = [UIImage imageNamed:@"SliderLeft.png"];
[slider setMinimumTrackImage:leftImage forState:UIControlStateNormal];
UIImage* rightImage = [UIImage imageNamed:@"SliderRight.png"];
[slider setMaximumTrackImage:rightImage forState:UIControlStateNormal];
答案 0 :(得分:14)
我相信你也需要设置突出显示的状态图像:
[slider setThumbImage:thumb forState:UIControlStateNormal];
[slider setThumbImage:thumb forState:UIControlStateHighlighted];