ZFSliderView.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. //
  2. // ZFSliderView.h
  3. // ZFPlayer
  4. //
  5. // Copyright (c) 2016年 任子丰 ( http://github.com/renzifeng )
  6. //
  7. // Permission is hereby granted, free of charge, to any person obtaining a copy
  8. // of this software and associated documentation files (the "Software"), to deal
  9. // in the Software without restriction, including without limitation the rights
  10. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. // copies of the Software, and to permit persons to whom the Software is
  12. // furnished to do so, subject to the following conditions:
  13. //
  14. // The above copyright notice and this permission notice shall be included in
  15. // all copies or substantial portions of the Software.
  16. //
  17. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  21. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  22. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  23. // THE SOFTWARE.
  24. #import <UIKit/UIKit.h>
  25. @protocol ZFSliderViewDelegate <NSObject>
  26. @optional
  27. // 滑块滑动开始
  28. - (void)sliderTouchBegan:(float)value;
  29. // 滑块滑动中
  30. - (void)sliderValueChanged:(float)value;
  31. // 滑块滑动结束
  32. - (void)sliderTouchEnded:(float)value;
  33. // 滑杆点击
  34. - (void)sliderTapped:(float)value;
  35. @end
  36. @interface ZFSliderButton : UIButton
  37. @end
  38. @interface ZFSliderView : UIView
  39. @property (nonatomic, weak) id<ZFSliderViewDelegate> delegate;
  40. /** 滑块 */
  41. @property (nonatomic, strong, readonly) ZFSliderButton *sliderBtn;
  42. /** 默认滑杆的颜色 */
  43. @property (nonatomic, strong) UIColor *maximumTrackTintColor;
  44. /** 滑杆进度颜色 */
  45. @property (nonatomic, strong) UIColor *minimumTrackTintColor;
  46. /** 缓存进度颜色 */
  47. @property (nonatomic, strong) UIColor *bufferTrackTintColor;
  48. /** loading进度颜色 */
  49. @property (nonatomic, strong) UIColor *loadingTintColor;
  50. /** 默认滑杆的图片 */
  51. @property (nonatomic, strong) UIImage *maximumTrackImage;
  52. /** 滑杆进度的图片 */
  53. @property (nonatomic, strong) UIImage *minimumTrackImage;
  54. /** 缓存进度的图片 */
  55. @property (nonatomic, strong) UIImage *bufferTrackImage;
  56. /** 滑杆进度 */
  57. @property (nonatomic, assign) float value;
  58. /** 缓存进度 */
  59. @property (nonatomic, assign) float bufferValue;
  60. /** 是否允许点击,默认是YES */
  61. @property (nonatomic, assign) BOOL allowTapped;
  62. /** 是否允许点击,默认是YES */
  63. @property (nonatomic, assign) BOOL animate;
  64. /** 设置滑杆的高度 */
  65. @property (nonatomic, assign) CGFloat sliderHeight;
  66. /** 设置滑杆的圆角 */
  67. @property (nonatomic, assign) CGFloat sliderRadius;
  68. /** 是否隐藏滑块(默认为NO) */
  69. @property (nonatomic, assign) BOOL isHideSliderBlock;
  70. /// 是否正在拖动
  71. @property (nonatomic, assign) BOOL isdragging;
  72. /// 向前还是向后拖动
  73. @property (nonatomic, assign) BOOL isForward;
  74. @property (nonatomic, assign) CGSize thumbSize;
  75. /**
  76. * Starts animation of the spinner.
  77. */
  78. - (void)startAnimating;
  79. /**
  80. * Stops animation of the spinnner.
  81. */
  82. - (void)stopAnimating;
  83. // 设置滑块背景色
  84. - (void)setBackgroundImage:(UIImage *)image forState:(UIControlState)state;
  85. // 设置滑块图片
  86. - (void)setThumbImage:(UIImage *)image forState:(UIControlState)state;
  87. @end