ASPointEranCell.m 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. //
  2. // ASPointEranCell.m
  3. // Asteria
  4. //
  5. // Created by iOS on 2023/6/24.
  6. //
  7. #import "ASPointEranCell.h"
  8. @interface ASPointEranCell ()
  9. @property (nonatomic, strong) UILabel *titleLb;
  10. @property (nonatomic, strong) UILabel *desLb;
  11. @property (nonatomic, strong) UIImageView *moreIconV;
  12. @property (nonatomic, strong) UIView *lineV;
  13. @end
  14. @implementation ASPointEranCell
  15. - (void)setData:(NSString *)title des:(NSString *)des status:(BOOL)status {
  16. self.titleLb.text = title;
  17. self.desLb.text = des;
  18. if (status) {
  19. self.titleLb.textColor = Col_666;
  20. self.titleLb.font = [UIFont fontWithName:Rob_Regular size:14];
  21. self.desLb.textColor = Col_000;
  22. self.moreIconV.hidden = true;
  23. } else {
  24. self.titleLb.textColor = Col_000;
  25. self.titleLb.font = [UIFont fontWithName:Rob_Bold size:14];
  26. self.desLb.textColor = Col_000;
  27. self.moreIconV.hidden = false;
  28. }
  29. }
  30. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  31. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  32. if (self) {
  33. [self loadSubVs];
  34. }
  35. return self;
  36. }
  37. - (void)loadSubVs {
  38. self.selectionStyle = UITableViewCellSelectionStyleNone;
  39. [self.contentView addSubview:self.lineV];
  40. [self.contentView addSubview:self.titleLb];
  41. [self.contentView addSubview:self.desLb];
  42. [self.contentView addSubview:self.moreIconV];
  43. [self.titleLb mas_makeConstraints:^(MASConstraintMaker *make) {
  44. make.top.leading.equalTo(self.contentView).offset(20);
  45. make.bottom.equalTo(self.contentView).offset(-20);
  46. make.height.greaterThanOrEqualTo(@17);
  47. }];
  48. [self.moreIconV mas_makeConstraints:^(MASConstraintMaker *make) {
  49. make.width.equalTo(@7);
  50. make.height.equalTo(@17);
  51. make.top.equalTo(self.contentView).offset(20);
  52. make.trailing.equalTo(self.contentView).offset(-20);
  53. make.leading.equalTo(self.desLb.mas_trailing).offset(10);
  54. }];
  55. [self.desLb mas_makeConstraints:^(MASConstraintMaker *make) {
  56. make.top.equalTo(self.contentView).offset(20);
  57. make.leading.equalTo(self.titleLb.mas_trailing).offset(10);
  58. make.width.equalTo(@112);
  59. make.height.equalTo(@17);
  60. }];
  61. [self.lineV mas_makeConstraints:^(MASConstraintMaker *make) {
  62. make.leading.equalTo(self.contentView).offset(20);
  63. make.trailing.equalTo(self.contentView).offset(-20);
  64. make.bottom.equalTo(self.contentView);
  65. make.height.equalTo(@1);
  66. }];
  67. [self.desLb setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
  68. [self.titleLb setContentHuggingPriority:UILayoutPriorityFittingSizeLevel forAxis:UILayoutConstraintAxisHorizontal];
  69. [self.titleLb setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisVertical];
  70. }
  71. - (void)awakeFromNib {
  72. [super awakeFromNib];
  73. // Initialization code
  74. }
  75. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  76. [super setSelected:selected animated:animated];
  77. // Configure the view for the selected state
  78. }
  79. - (UILabel *)titleLb {
  80. if (!_titleLb) {
  81. UILabel *lb = [[UILabel alloc] init];
  82. lb.textColor = Col_000;
  83. lb.font = [UIFont fontWithName:Rob_Bold size:14];
  84. lb.textAlignment = NSTextAlignmentLeft;
  85. lb.numberOfLines = 0;
  86. _titleLb = lb;
  87. }
  88. return _titleLb;
  89. }
  90. - (UILabel *)desLb {
  91. if (!_desLb) {
  92. UILabel *lb = [[UILabel alloc] init];
  93. lb.textColor = Col_000;
  94. lb.font = [UIFont fontWithName:Rob_Regular size:14];
  95. lb.textAlignment = NSTextAlignmentRight;
  96. _desLb = lb;
  97. }
  98. return _desLb;
  99. }
  100. - (UIImageView *)moreIconV {
  101. if (!_moreIconV) {
  102. UIImageView *v = [UIImageView new];
  103. v.contentMode = UIViewContentModeScaleAspectFit;
  104. v.image = [UIImage imageNamed:@"uc_more"];
  105. _moreIconV = v;
  106. }
  107. return _moreIconV;
  108. }
  109. - (UIView *)lineV {
  110. if (!_lineV) {
  111. UIView *v = [UIView new];
  112. v.backgroundColor = _043632;
  113. v.alpha = 0.1;
  114. _lineV = v;
  115. }
  116. return _lineV;
  117. }
  118. @end