ASVipCenterLineItemView.m 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. - (void)selectBtAction {
  20. if (self.selectCallBack) {
  21. self.selectCallBack();
  22. }
  23. }
  24. - (instancetype)initWithFrame:(CGRect)frame {
  25. self = [super initWithFrame:frame];
  26. if (self) {
  27. [self loadSubVs];
  28. }
  29. return self;
  30. }
  31. - (void)loadSubVs {
  32. self.backgroundColor = UIColor.clearColor;
  33. [self addSubview:self.titleLb];
  34. [self addSubview:self.moreV];
  35. [self addSubview:self.lineV];
  36. [self addSubview:self.bt];
  37. [self.titleLb mas_makeConstraints:^(MASConstraintMaker *make) {
  38. make.height.equalTo(@78);
  39. make.top.bottom.equalTo(self);
  40. make.leading.equalTo(self).offset(30);
  41. }];
  42. [self.moreV mas_makeConstraints:^(MASConstraintMaker *make) {
  43. make.width.equalTo(@7);
  44. make.height.equalTo(@13);
  45. make.centerY.equalTo(self.titleLb);
  46. make.trailing.equalTo(self).offset(-30);
  47. }];
  48. [self.lineV mas_makeConstraints:^(MASConstraintMaker *make) {
  49. make.leading.equalTo(self.titleLb);
  50. make.trailing.equalTo(self.moreV);
  51. make.height.equalTo(@1);
  52. make.bottom.equalTo(self);
  53. }];
  54. [self.bt mas_makeConstraints:^(MASConstraintMaker *make) {
  55. make.edges.equalTo(self);
  56. }];
  57. }
  58. // MARK: - subVs
  59. - (UILabel *)titleLb {
  60. if (!_titleLb) {
  61. UILabel *lb = [UILabel baseLb];
  62. lb.font = [UIFont fontWithName:Rob_Bold size:14];
  63. lb.textColor = Col_000;
  64. _titleLb = lb;
  65. }
  66. return _titleLb;
  67. }
  68. - (UIImageView *)moreV {
  69. if (!_moreV) {
  70. UIImageView *v = [UIImageView baseImgV];
  71. v.image = [UIImage imageNamed:@"uc_more"];
  72. _moreV = v;
  73. }
  74. return _moreV;
  75. }
  76. - (UIView *)lineV {
  77. if (!_lineV) {
  78. UIView *v = [UIView baseV];
  79. v.backgroundColor = _043632;
  80. v.alpha = 0.1;
  81. _lineV = v;
  82. }
  83. return _lineV;
  84. }
  85. - (UIButton *)bt {
  86. if (!_bt) {
  87. UIButton *b = [UIButton buttonWithType:UIButtonTypeCustom];
  88. [b addTarget:self action:@selector(selectBtAction) forControlEvents:UIControlEventTouchUpInside];
  89. _bt = b;
  90. }
  91. return _bt;
  92. }
  93. @end