FULightingSlider.m 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //
  2. // FULightingSlider.m
  3. // FULiveDemo
  4. //
  5. // Created by L on 2018/9/20.
  6. // Copyright © 2018年 L. All rights reserved.
  7. //
  8. #import "FULightingSlider.h"
  9. @implementation FULightingSlider
  10. {
  11. UIView *line;
  12. }
  13. -(instancetype)initWithFrame:(CGRect)frame{
  14. if (self = [super initWithFrame:frame]) {
  15. [self setThumbImage:[UIImage imageNamed:@"render_lighting"] forState:UIControlStateNormal];
  16. [self setMaximumTrackTintColor:[UIColor whiteColor]];
  17. [self setMinimumTrackTintColor:[UIColor whiteColor]];
  18. }
  19. return self;
  20. }
  21. - (void)awakeFromNib {
  22. [super awakeFromNib];
  23. [self setThumbImage:[UIImage imageNamed:@"render_lighting"] forState:UIControlStateNormal];
  24. [self setMaximumTrackTintColor:[UIColor whiteColor]];
  25. [self setMinimumTrackTintColor:[UIColor whiteColor]];
  26. }
  27. -(void)layoutSubviews {
  28. [super layoutSubviews];
  29. if (!line) {
  30. line = [[UIView alloc] init];
  31. line.backgroundColor = [UIColor whiteColor];
  32. line.layer.masksToBounds = YES;
  33. line.layer.cornerRadius = 1.0;
  34. [self insertSubview:line atIndex: self.subviews.count - 1];
  35. }
  36. line.frame = CGRectMake(self.frame.size.width / 2.0 - 1.0, 4.0, 2.0, self.frame.size.height - 8.0);
  37. CGFloat value = self.value;
  38. [self setValue:value animated:NO];
  39. }
  40. - (void)setValue:(float)value animated:(BOOL)animated {
  41. [super setValue:value animated:animated];
  42. }
  43. @end