| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208 | ////  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- (void)setData:(NSString *)num {    self.numLb.text = num;}- (void)ruleAction {    if (self.ruleCallBack) {        self.ruleCallBack();    }}- (void)detailAction {    if (self.detailCallBack) {        self.detailCallBack();    }}- (instancetype)initWithFrame:(CGRect)frame {    CGRect rect = CGRectMake(0, 0, KScreenWidth, 205);    self = [super initWithFrame:rect];    if (self) {        [self loadsubV];    }    return self;}- (void)loadsubV {    self.backgroundColor = _E0FFF5;    [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);        make.bottom.leading.trailing.equalTo(self);    }];        [self.topBgV mas_makeConstraints:^(MASConstraintMaker *make) {        make.top.leading.trailing.equalTo(self);        make.height.equalTo(@135);    }];        [self.numLb mas_makeConstraints:^(MASConstraintMaker *make) {        make.leading.equalTo(self.topBgV).offset(30);        make.height.equalTo(@58);        make.top.equalTo(self.topBgV).offset(30);    }];        [self.numDesLb mas_makeConstraints:^(MASConstraintMaker *make) {        make.leading.equalTo(self.numLb);        make.top.equalTo(self.numLb.mas_bottom);        make.height.equalTo(@17);    }];    [self.ruleBt mas_makeConstraints:^(MASConstraintMaker *make) {        make.width.equalTo(@44);        make.top.equalTo(self.topBgV).offset(30);        make.trailing.equalTo(self.topBgV).offset(-15);        make.height.equalTo(@17);    }];    [self.detailBt mas_makeConstraints:^(MASConstraintMaker *make) {        make.height.equalTo(self.ruleBt);        make.width.equalTo(@53);        make.trailing.equalTo(self.ruleBt.mas_leading).offset(0);        make.centerY.equalTo(self.ruleBt);    }];        [self.bottomTitleLb mas_makeConstraints:^(MASConstraintMaker *make) {        make.top.equalTo(self.bottomBgV).offset(30);        make.leading.equalTo(self.bottomBgV).offset(20);        make.trailing.equalTo(self.bottomBgV).offset(-20);        make.height.equalTo(@30);    }];}- (UIView *)topBgV {    if (!_topBgV) {        UIView *v = [UIView baseV];        v.backgroundColor = _E0FFF5;        _topBgV = v;    }    return _topBgV;}- (UIView *)bottomBgV {    if (!_bottomBgV) {        UIView *v = [UIView baseV];        v.frame = CGRectMake(0, 0, KScreenWidth, 70);        v.backgroundColor = Col_FFF;                // 左上和右上为圆角        UIBezierPath *cornerRadiusPath = [UIBezierPath      bezierPathWithRoundedRect:v.bounds byRoundingCorners:UIRectCornerTopRight | UIRectCornerTopLeft cornerRadii:CGSizeMake(16, 16)];                CAShapeLayer *cornerRadiusLayer = [ [CAShapeLayer alloc ] init];        cornerRadiusLayer.frame = v.bounds;                cornerRadiusLayer.path = cornerRadiusPath.CGPath;                v.layer.mask = cornerRadiusLayer;        _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];        [bt addTarget:self action:@selector(detailAction) forControlEvents:UIControlEventTouchUpInside];        _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];        [bt addTarget:self action:@selector(ruleAction) forControlEvents:UIControlEventTouchUpInside];        _ruleBt = bt;    }    return _ruleBt;}@end
 |