自定义一个继承于UISlider的类 重写touchesBegan方法:
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
CGRect t = [self trackRectForBounds: [self bounds]];
float v = [self minimumValue] + ([[touches anyObject] locationInView: self].x - t.origin.x - 4.0) * (([self maximumValue]-[self minimumValue]) / (t.size.width - 8.0));
[self setValue: v];
[super touchesBegan: touches withEvent: event];
}