ASVipCenterLineItemView.m 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. //
  2. // ASVipCenterLineItemView.m
  3. // Asteria
  4. //
  5. // Created by iOS on 2023/6/27.
  6. //
  7. #import "ASVipCenterLineItemView.h"
  8. @interface ASVipCenterLineItemView ()
  9. @property (nonatomic, strong) UILabel *titleLb;
  10. @property (nonatomic, strong) UIImageView *moreV;
  11. @property (nonatomic, strong) UIView *lineV;
  12. @property (nonatomic, strong) UIButton *bt;
  13. @end
  14. @implementation ASVipCenterLineItemView
  15. - (void)setData:(NSString *)title canGoNext:(BOOL)canGoNext {
  16. self.titleLb.text = title;
  17. self.bt.hidden = !canGoNext;
  18. }
  19. - (instancetype)initWithFrame:(CGRect)frame {
  20. self = [super initWithFrame:frame];
  21. if (self) {
  22. [self loadSubVs];
  23. }
  24. return self;
  25. }
  26. - (void)loadSubVs {
  27. self.backgroundColor = UIColor.clearColor;
  28. [self addSubview:self.titleLb];
  29. [self addSubview:self.moreV];
  30. [self addSubview:self.lineV];
  31. [self addSubview:self.bt];
  32. [self.titleLb mas_makeConstraints:^(MASConstraintMaker *make) {
  33. make.height.equalTo(@78);
  34. make.top.bottom.equalTo(self);
  35. make.leading.equalTo(self).offset(30);
  36. }];
  37. [self.moreV mas_makeConstraints:^(MASConstraintMaker *make) {
  38. make.width.equalTo(@7);
  39. make.height.equalTo(@13);
  40. make.centerY.equalTo(self.titleLb);
  41. make.trailing.equalTo(self).offset(-30);
  42. }];
  43. [self.lineV mas_makeConstraints:^(MASConstraintMaker *make) {
  44. make.leading.equalTo(self.titleLb);
  45. make.trailing.equalTo(self.moreV);
  46. make.height.equalTo(@1);
  47. make.bottom.equalTo(self);
  48. }];
  49. [self.bt mas_makeConstraints:^(MASConstraintMaker *make) {
  50. make.edges.equalTo(self);
  51. }];
  52. }
  53. // MARK: - subVs
  54. - (UILabel *)titleLb {
  55. if (!_titleLb) {
  56. UILabel *lb = [UILabel baseLb];
  57. lb.font = [UIFont fontWithName:Rob_Bold size:14];
  58. lb.textColor = Col_000;
  59. _titleLb = lb;
  60. }
  61. return _titleLb;
  62. }
  63. - (UIImageView *)moreV {
  64. if (!_moreV) {
  65. UIImageView *v = [UIImageView baseImgV];
  66. v.image = [UIImage imageNamed:@"uc_more"];
  67. _moreV = v;
  68. }
  69. return _moreV;
  70. }
  71. - (UIView *)lineV {
  72. if (!_lineV) {
  73. UIView *v = [UIView baseV];
  74. v.backgroundColor = _043632;
  75. v.alpha = 0.1;
  76. _lineV = v;
  77. }
  78. return _lineV;
  79. }
  80. - (UIButton *)bt {
  81. if (!_bt) {
  82. UIButton *b = [UIButton buttonWithType:UIButtonTypeCustom];
  83. _bt = b;
  84. }
  85. return _bt;
  86. }
  87. @end