第四篇 - UISlider
初始化 UISlider
UISlider *slider = [[UISlider alloc] init];
//NS_ASSUME_NONNULL_BEGIN
//
//@class UIImageView, UIImage;
//
//NS_CLASS_AVAILABLE_IOS(2_0) __TVOS_PROHIBITED @interface UISlider : UIControl <NSCoding>
//
//设置滑块位置
//这个值是介于滑块的最大值和最小值之间的,如果没有设置边界值,默认为0-1;
//@property(nonatomic) float value; // default 0.0. this value will be pinned to min/max
//@property(nonatomic) float minimumValue; // default 0.0. the current value may change if outside new min value
//@property(nonatomic) float maximumValue; // default 1.0. the current value may change if outside new max value
//
//@property(nullable, nonatomic,strong) UIImage *minimumValueImage; // default is nil. image that appears to left of control (e.g. speaker off)
//@property(nullable, nonatomic,strong) UIImage *maximumValueImage; // default is nil. image that appears to right of control (e.g. speaker max)
//
//设置滑块值是否连续变化(默认为YES)
//这个属性设置为YES则在滑动时,其value就会随时变化,设置为NO,则当滑动结束时,value才会改变。
//@property(nonatomic,getter=isContinuous) BOOL continuous; // if set, value change events are generated any time the value changes due to dragging. default = YES
//
//设置滑块左边(小于部分)线条的颜色
//@property(nullable, nonatomic,strong) UIColor *minimumTrackTintColor NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR;
//@property(nullable, nonatomic,strong) UIColor *maximumTrackTintColor NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR;
//设置滑块颜色(影响已划过一端的颜色)
//@property(nullable, nonatomic,strong) UIColor *thumbTintColor NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR;
// 注意,当你设置了setThumbImage时,同时也设置了thumbTintColor这个属性。那么,当你点击滑块时,会有变化。而当你设置setThumbImage,不设置thumbTintColor时。则滑块只是你所设置的图片。
//
//- (void)setValue:(float)value animated:(BOOL)animated; // move slider at fixed velocity (i.e. duration depends on distance). does not send action
//
//// set the images for the slider. there are 3, the thumb which is centered by default and the track. You can specify different left and right track
//// e.g blue on the left as you increase and white to the right of the thumb. The track images should be 3 part resizable (via UIImage's resizableImage methods) along the direction that is longer
//
//设置滑块的图片:
//- (void)setThumbImage:(nullable UIImage *)image forState:(UIControlState)state;
//设置滑块划过部分的线条图案
//- (void)setMinimumTrackImage:(nullable UIImage *)image forState:(UIControlState)state;
//- (void)setMaximumTrackImage:(nullable UIImage *)image forState:(UIControlState)state;
//
//- (nullable UIImage *)thumbImageForState:(UIControlState)state;
//- (nullable UIImage *)minimumTrackImageForState:(UIControlState)state;
//- (nullable UIImage *)maximumTrackImageForState:(UIControlState)state;
//
//@property(nullable,nonatomic,readonly) UIImage *currentThumbImage;
//@property(nullable,nonatomic,readonly) UIImage *currentMinimumTrackImage;
//@property(nullable,nonatomic,readonly) UIImage *currentMaximumTrackImage;
//
//// lets a subclass lay out the track and thumb as needed
//自定义滑块,重写覆盖使用
//- (CGRect)minimumValueImageRectForBounds:(CGRect)bounds;
//- (CGRect)maximumValueImageRectForBounds:(CGRect)bounds;
//- (CGRect)trackRectForBounds:(CGRect)bounds;
//- (CGRect)thumbRectForBounds:(CGRect)bounds trackRect:(CGRect)rect value:(float)value;