123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- //
- // YMCaptchaTextLineView.m
- // MSYOUPAI
- //
- // Created by YoMi on 2023/5/5.
- //
- #import "YMCaptchaTextLineView.h"
- @interface YMCaptchaTextLineView()
- @end
- @implementation YMCaptchaTextLineView
- - (instancetype)init{
- if (self = [super init]) {
- _underlineColorNormal = [UIColor colorWithRed:49/255.0 green:51/255.0 blue:64/255.0 alpha:1];
- _underlineColorSelected = [UIColor colorWithRed:49/255.0 green:51/255.0 blue:64/255.0 alpha:1];
- _underlineColorFilled = [UIColor colorWithRed:49/255.0 green:51/255.0 blue:64/255.0 alpha:1];
- [self createUI];
- }
- return self;
- }
- - (void)createUI{
- static CGFloat sepLineViewHeight = 4;
-
- _lineView = [UIView new];
- [self addSubview:_lineView];
- _lineView.backgroundColor = _underlineColorNormal;
- _lineView.layer.cornerRadius = sepLineViewHeight / 2.0;
- [_lineView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.height.mas_equalTo(sepLineViewHeight);
- make.left.right.bottom.offset(0);
- }];
-
- _lineView.layer.shadowColor = [[UIColor blackColor] colorWithAlphaComponent:0.2].CGColor;
- _lineView.layer.shadowOpacity = 1;
- _lineView.layer.shadowOffset = CGSizeMake(0, 2);
- _lineView.layer.shadowRadius = 4;
- }
- - (void)setSelected:(BOOL)selected {
- _selected = selected;
-
- if (self.selectChangeBlock) {
- __weak __typeof(self)weakSelf = self;
- self.selectChangeBlock(weakSelf, selected);
- }
- }
- @end
|