有谁知道如何设置 a 的起始位置UISlider
(理想情况下在中间)以及如何以十而不是十递增?
这是我到目前为止所得到的:
// Setup custom slider images
UIImage *minImage = [UIImage imageNamed:@"ins_blueTrack.png"];
UIImage *maxImage = [UIImage imageNamed:@"ins_whiteTrack.png"];
UIImage *tumbImage= [UIImage imageNamed:@"slide.png"];
minImage=[minImage stretchableImageWithLeftCapWidth:6.0 topCapHeight:0.0];
maxImage=[maxImage stretchableImageWithLeftCapWidth:6.0 topCapHeight:0.0];
// Setup the slider
[self.slider setMinimumTrackImage:minImage forState:UIControlStateNormal];
[self.slider setMaximumTrackImage:maxImage forState:UIControlStateNormal];
[self.slider setThumbImage:tumbImage forState:UIControlStateNormal];
self.slider.minimumValue = 10;
self.slider.maximumValue = 180;
self.slider.continuous = YES;
int myVal = self.slider.value;
NSString *timeValue = [[NSString alloc] initWithFormat:@"%1d", myVal];
self.timeLabel.text = timeValue;
// Attach an action to sliding
[self.slider addTarget:self action:@selector(fxSliderAction) forControlEvents:UIControlEventValueChanged];