效果图:
效果图
创建UISlider
_slider.maximumValue = 4;
_slider.minimumValue = 0;
_slider.continuous = YES;
[_slider addTarget:self
action:@selector(valueChanged:)
forControlEvents:UIControlEventValueChanged];
[_slider setMinimumTrackImage:[UIImage imageNamed:@"jt"] forState:UIControlStateNormal];
[_slider setMaximumTrackImage:[UIImage imageNamed:@"ht"] forState:UIControlStateNormal];
[_slider setThumbImage:[UIImage imageNamed:@"yd"] forState:UIControlStateNormal];
[_slider setValue:1 animated:NO];
- (void)valueChanged:(UISlider *)sender {
NSUInteger index = (NSUInteger)(_slider.value + 0.5);
[_slider setValue:index animated:YES];
NSString *select = _numArr[index]; //选中的某个值
}
网友评论