ASPointHeadView.m 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. //
  2. // ASPointHeadView.m
  3. // Asteria
  4. //
  5. // Created by iOS on 2023/6/19.
  6. //
  7. #import "ASPointHeadView.h"
  8. @interface ASPointHeadView ()
  9. @property (nonatomic, strong) UIView *topBgV;
  10. @property (nonatomic, strong) UIView *bottomBgV;
  11. @property (nonatomic, strong) UILabel *numLb;
  12. @property (nonatomic, strong) UILabel *numDesLb;
  13. @property (nonatomic, strong) UIButton *detailBt;
  14. @property (nonatomic, strong) UIButton *ruleBt;
  15. @property (nonatomic, strong) UILabel *bottomTitleLb;
  16. @end
  17. @implementation ASPointHeadView
  18. - (instancetype)initWithFrame:(CGRect)frame {
  19. self = [super initWithFrame:frame];
  20. if (self) {
  21. [self loadsubV];
  22. }
  23. return self;
  24. }
  25. - (void)loadsubV {
  26. [self addSubview:self.topBgV];
  27. [self addSubview:self.bottomBgV];
  28. [self.topBgV addSubview:self.numLb];
  29. [self.topBgV addSubview:self.numDesLb];
  30. [self.topBgV addSubview:self.detailBt];
  31. [self.topBgV addSubview:self.ruleBt];
  32. [self.bottomBgV addSubview:self.bottomTitleLb];
  33. [self.bottomBgV mas_makeConstraints:^(MASConstraintMaker *make) {
  34. make.height.equalTo(@70);
  35. }];
  36. }
  37. - (UIView *)topBgV {
  38. if (!_topBgV) {
  39. UIView *v = [UIView baseV];
  40. v.backgroundColor = _E0FFF5;
  41. _topBgV = v;
  42. }
  43. return _topBgV;
  44. }
  45. - (UIView *)bottomBgV {
  46. if (!_bottomBgV) {
  47. UIView *v = [UIView baseV];
  48. v.backgroundColor = Col_FFF;
  49. _bottomBgV = v;
  50. }
  51. return _bottomBgV;
  52. }
  53. - (UILabel *)bottomTitleLb {
  54. if (!_bottomTitleLb) {
  55. UILabel *lb = [UILabel baseLb];
  56. lb.font = [UIFont fontWithName:Rob_Bold size:24];
  57. lb.textColor = Col_000;
  58. lb.textAlignment = NSTextAlignmentLeft;
  59. lb.text = @"ERAN POINTS";
  60. _bottomTitleLb = lb;
  61. }
  62. return _bottomTitleLb;
  63. }
  64. - (UILabel *)numLb {
  65. if (!_numLb) {
  66. UILabel *lb = [UILabel baseLb];
  67. lb.font = [UIFont fontWithName:Rob_Bold size:48];
  68. lb.textColor = Col_000;
  69. lb.textAlignment = NSTextAlignmentLeft;
  70. _numLb = lb;
  71. }
  72. return _numLb;
  73. }
  74. - (UILabel *)numDesLb {
  75. if (!_numDesLb) {
  76. UILabel *lb = [UILabel baseLb];
  77. lb.font = [UIFont fontWithName:Rob_Regular size:14];
  78. lb.textColor = Col_000;
  79. lb.textAlignment = NSTextAlignmentLeft;
  80. lb.text = @"My Points";
  81. _numDesLb = lb;
  82. }
  83. return _numDesLb;
  84. }
  85. - (UIButton *)detailBt {
  86. if (!_detailBt) {
  87. UIButton *bt = [UIButton buttonWithType:UIButtonTypeCustom];
  88. NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:@"Details"];
  89. [str addAttributes:@{
  90. NSForegroundColorAttributeName:_0B0B0B,
  91. NSUnderlineStyleAttributeName: @(NSUnderlineStyleSingle),
  92. NSFontAttributeName:[UIFont fontWithName:Rob_Regular size:14]
  93. } range:NSMakeRange(0, str.length)];
  94. [bt setAttributedTitle:str forState:UIControlStateNormal];
  95. _detailBt = bt;
  96. }
  97. return _detailBt;
  98. }
  99. - (UIButton *)ruleBt {
  100. if (!_ruleBt) {
  101. UIButton *bt = [UIButton buttonWithType:UIButtonTypeCustom];
  102. NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:@"Rules"];
  103. [str addAttributes:@{
  104. NSForegroundColorAttributeName:_0B0B0B,
  105. NSUnderlineStyleAttributeName: @(NSUnderlineStyleSingle),
  106. NSFontAttributeName:[UIFont fontWithName:Rob_Regular size:14]
  107. } range:NSMakeRange(0, str.length)];
  108. [bt setAttributedTitle:str forState:UIControlStateNormal];
  109. _ruleBt = bt;
  110. }
  111. return _ruleBt;
  112. }
  113. @end