YMCaptchaTextLineView.m 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. //
  2. // YMCaptchaTextLineView.m
  3. // MSYOUPAI
  4. //
  5. // Created by YoMi on 2023/5/5.
  6. //
  7. #import "YMCaptchaTextLineView.h"
  8. @interface YMCaptchaTextLineView()
  9. @end
  10. @implementation YMCaptchaTextLineView
  11. - (instancetype)init{
  12. if (self = [super init]) {
  13. _underlineColorNormal = [UIColor colorWithRed:49/255.0 green:51/255.0 blue:64/255.0 alpha:1];
  14. _underlineColorSelected = [UIColor colorWithRed:49/255.0 green:51/255.0 blue:64/255.0 alpha:1];
  15. _underlineColorFilled = [UIColor colorWithRed:49/255.0 green:51/255.0 blue:64/255.0 alpha:1];
  16. [self createUI];
  17. }
  18. return self;
  19. }
  20. - (void)createUI{
  21. static CGFloat sepLineViewHeight = 4;
  22. _lineView = [UIView new];
  23. [self addSubview:_lineView];
  24. _lineView.backgroundColor = _underlineColorNormal;
  25. _lineView.layer.cornerRadius = sepLineViewHeight / 2.0;
  26. [_lineView mas_makeConstraints:^(MASConstraintMaker *make) {
  27. make.height.mas_equalTo(sepLineViewHeight);
  28. make.left.right.bottom.offset(0);
  29. }];
  30. _lineView.layer.shadowColor = [[UIColor blackColor] colorWithAlphaComponent:0.2].CGColor;
  31. _lineView.layer.shadowOpacity = 1;
  32. _lineView.layer.shadowOffset = CGSizeMake(0, 2);
  33. _lineView.layer.shadowRadius = 4;
  34. }
  35. - (void)setSelected:(BOOL)selected {
  36. _selected = selected;
  37. if (self.selectChangeBlock) {
  38. __weak __typeof(self)weakSelf = self;
  39. self.selectChangeBlock(weakSelf, selected);
  40. }
  41. }
  42. @end