// // ASPointHeadView.m // Asteria // // Created by iOS on 2023/6/19. // #import "ASPointHeadView.h" @interface ASPointHeadView () @property (nonatomic, strong) UIView *topBgV; @property (nonatomic, strong) UIView *bottomBgV; @property (nonatomic, strong) UILabel *numLb; @property (nonatomic, strong) UILabel *numDesLb; @property (nonatomic, strong) UIButton *detailBt; @property (nonatomic, strong) UIButton *ruleBt; @property (nonatomic, strong) UILabel *bottomTitleLb; @end @implementation ASPointHeadView - (instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { [self loadsubV]; } return self; } - (void)loadsubV { [self addSubview:self.topBgV]; [self addSubview:self.bottomBgV]; [self.topBgV addSubview:self.numLb]; [self.topBgV addSubview:self.numDesLb]; [self.topBgV addSubview:self.detailBt]; [self.topBgV addSubview:self.ruleBt]; [self.bottomBgV addSubview:self.bottomTitleLb]; [self.bottomBgV mas_makeConstraints:^(MASConstraintMaker *make) { make.height.equalTo(@70); }]; } - (UIView *)topBgV { if (!_topBgV) { UIView *v = [UIView baseV]; v.backgroundColor = _E0FFF5; _topBgV = v; } return _topBgV; } - (UIView *)bottomBgV { if (!_bottomBgV) { UIView *v = [UIView baseV]; v.backgroundColor = Col_FFF; _bottomBgV = v; } return _bottomBgV; } - (UILabel *)bottomTitleLb { if (!_bottomTitleLb) { UILabel *lb = [UILabel baseLb]; lb.font = [UIFont fontWithName:Rob_Bold size:24]; lb.textColor = Col_000; lb.textAlignment = NSTextAlignmentLeft; lb.text = @"ERAN POINTS"; _bottomTitleLb = lb; } return _bottomTitleLb; } - (UILabel *)numLb { if (!_numLb) { UILabel *lb = [UILabel baseLb]; lb.font = [UIFont fontWithName:Rob_Bold size:48]; lb.textColor = Col_000; lb.textAlignment = NSTextAlignmentLeft; _numLb = lb; } return _numLb; } - (UILabel *)numDesLb { if (!_numDesLb) { UILabel *lb = [UILabel baseLb]; lb.font = [UIFont fontWithName:Rob_Regular size:14]; lb.textColor = Col_000; lb.textAlignment = NSTextAlignmentLeft; lb.text = @"My Points"; _numDesLb = lb; } return _numDesLb; } - (UIButton *)detailBt { if (!_detailBt) { UIButton *bt = [UIButton buttonWithType:UIButtonTypeCustom]; NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:@"Details"]; [str addAttributes:@{ NSForegroundColorAttributeName:_0B0B0B, NSUnderlineStyleAttributeName: @(NSUnderlineStyleSingle), NSFontAttributeName:[UIFont fontWithName:Rob_Regular size:14] } range:NSMakeRange(0, str.length)]; [bt setAttributedTitle:str forState:UIControlStateNormal]; _detailBt = bt; } return _detailBt; } - (UIButton *)ruleBt { if (!_ruleBt) { UIButton *bt = [UIButton buttonWithType:UIButtonTypeCustom]; NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:@"Rules"]; [str addAttributes:@{ NSForegroundColorAttributeName:_0B0B0B, NSUnderlineStyleAttributeName: @(NSUnderlineStyleSingle), NSFontAttributeName:[UIFont fontWithName:Rob_Regular size:14] } range:NSMakeRange(0, str.length)]; [bt setAttributedTitle:str forState:UIControlStateNormal]; _ruleBt = bt; } return _ruleBt; } @end