Files
CRBoxInputView/PodCode/Classes/CRLineView.m

61 lines
1.3 KiB
Mathematica
Raw Permalink Normal View History

2019-06-10 19:23:37 +08:00
//
// CRLineView.m
// CRBoxInputView_Example
//
// Created by Chobits on 2019/6/10.
// Copyright © 2019 BearRan. All rights reserved.
//
#import "CRLineView.h"
2019-06-11 13:44:48 +08:00
#import <Masonry/Masonry.h>
2019-06-10 19:23:37 +08:00
2019-06-11 08:10:58 +08:00
@interface CRLineView()
{
}
@end
2019-06-10 19:23:37 +08:00
@implementation CRLineView
- (instancetype)init
{
self = [super init];
if (self) {
2019-08-01 17:48:07 +08:00
_underlineColorNormal = CRColorMaster;
_underlineColorSelected = CRColorMaster;
2020-01-19 17:09:33 +08:00
_underlineColorFilled = CRColorMaster;
2019-06-10 19:23:37 +08:00
[self createUI];
}
return self;
}
- (void)createUI
{
static CGFloat sepLineViewHeight = 4;
2019-06-11 08:10:58 +08:00
_lineView = [UIView new];
[self addSubview:_lineView];
2019-08-01 17:48:07 +08:00
_lineView.backgroundColor = _underlineColorNormal;
2019-06-11 08:10:58 +08:00
_lineView.layer.cornerRadius = sepLineViewHeight / 2.0;
[_lineView mas_makeConstraints:^(MASConstraintMaker *make) {
2019-06-10 19:23:37 +08:00
make.height.mas_equalTo(sepLineViewHeight);
2019-06-11 08:10:58 +08:00
make.left.right.bottom.offset(0);
2019-06-10 19:23:37 +08:00
}];
2019-06-11 13:44:48 +08:00
_lineView.layer.shadowColor = [[UIColor blackColor] colorWithAlphaComponent:0.2].CGColor;
2019-06-11 08:10:58 +08:00
_lineView.layer.shadowOpacity = 1;
_lineView.layer.shadowOffset = CGSizeMake(0, 2);
_lineView.layer.shadowRadius = 4;
2019-06-10 19:23:37 +08:00
}
2020-06-10 22:57:53 +08:00
- (void)setSelected:(BOOL)selected {
_selected = selected;
2020-06-10 22:57:53 +08:00
if (self.selectChangeBlock) {
__weak __typeof(self)weakSelf = self;
self.selectChangeBlock(weakSelf, selected);
}
}
2019-06-10 19:23:37 +08:00
@end