美文网首页
iOS-纵向(竖向)滑动的VerticalSlider

iOS-纵向(竖向)滑动的VerticalSlider

作者: makemake | 来源:发表于2019-01-14 09:52 被阅读65次

    GQYVerticalSlider

    可以自定义背景图片和滑块的Slider,纵向(竖向)滑动
    API 跟系统UISlider 类似

    
    @property (nonatomic,strong)UIImage * minImage;
    @property (nonatomic,strong)UIImage * maxImage;
    @property (nonatomic,strong)UIImage * thumbImage;
    
    
    @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 (nonatomic,copy)void (^touchSliderValueChange)(CGFloat value);
    
    
    - (void)setValue:(float)value animated:(BOOL)animated;
    

    使用:

        GQYVerticalSlider *slider = [[GQYVerticalSlider alloc]initWithFrame:CGRectMake(100, 200, 20, 200)];
        [self.view addSubview:slider];
        
        slider.maximumValue = 100;
        slider.minimumValue = 30;
    
        
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            [slider setValue:44 animated:YES];
            
        });
    

    效果:


    demo.png

    相关文章

      网友评论

          本文标题:iOS-纵向(竖向)滑动的VerticalSlider

          本文链接:https://www.haomeiwen.com/subject/bsfddqtx.html