一、概述
二、属性
@property(nonatomic) float value;
2. 滑动的最小值;默认是 0
@property(nonatomic) float minimumValue;
3. 滑动的最大值;默认是 1;可以将其看做一个百分比
@property(nonatomic) float maximumValue;
4. 设置最小值那边的图片;默认为 nil,设置后会在控件的左边显示
@property(nullable, nonatomic,strong) UIImage *minimumValueImage;
5. 设置最大值那边的图片;默认为 nil,设置后会在控件的右边显示
@property(nullable, nonatomic,strong) UIImage *maximumValueImage;
6. 在任何时间改变 value 值都会引起 UIControlEventValueChange 事件;默认是 YES
@property(nonatomic,getter=isContinuous) BOOL continuous;
7. 设置最小值那边的颜色
@property(nullable, nonatomic,strong) UIColor *minimumTrackTintColor;
8. 设置最大值那边的颜色
@property(nullable, nonatomic,strong) UIColor *maximumTrackTintColor;
9. 设置按钮的颜色
@property(nullable, nonatomic,strong) UIColor *thumbTintColor;
// 5. 设置最小值那边的颜色
_slider.minimumTrackTintColor = [UIColor redColor];
// 6. 设置最大值那边的颜色
_slider.maximumTrackTintColor = [UIColor greenColor];
// 7. 设置按钮的颜色
_slider.thumbTintColor = [UIColor orangeColor];
10. 设置当前的 value 值,并设置动画效果
- (void)setValue:(float)value animated:(BOOL)animated;
11. 设置按钮图片在不同的状态
- (void)setThumbImage:(nullable UIImage *)image forState:(UIControlState)state;
12. 设置最小值那边的图片在不同的状态
- (void)setMinimumTrackImage:(nullable UIImage *)image forState:(UIControlState)state;
13. 设置最大值那边的图片在不同的状态
- (void)setMaximumTrackImage:(nullable UIImage *)image forState:(UIControlState)state;
14. 获取在不同状态时的按钮图片
- (nullable UIImage *)thumbImageForState:(UIControlState)state;
15. 获取在不同状态时的最小值那边的图片
- (nullable UIImage *)minimumTrackImageForState:(UIControlState)state;
16. 获取在不同状态时的最大值那边的图片
- (nullable UIImage *)maximumTrackImageForState:(UIControlState)state;
17. 获取当前状态的按钮图片
@property(nullable,nonatomic,readonly) UIImage *currentThumbImage;
18. 获取当前状态的最小值那边的图片
@property(nullable,nonatomic,readonly) UIImage *currentMinimumTrackImage;
19. 获取当前状态的最大值那边的图片
@property(nullable,nonatomic,readonly) UIImage *currentMaximumTrackImage;