ASPointEranCell.m 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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.backgroundColor = Col_FFF;
  39. self.contentView.backgroundColor = Col_FFF;
  40. self.selectionStyle = UITableViewCellSelectionStyleNone;
  41. [self.contentView addSubview:self.lineV];
  42. [self.contentView addSubview:self.titleLb];
  43. [self.contentView addSubview:self.desLb];
  44. [self.contentView addSubview:self.moreIconV];
  45. [self.titleLb mas_makeConstraints:^(MASConstraintMaker *make) {
  46. make.top.leading.equalTo(self.contentView).offset(20);
  47. make.bottom.equalTo(self.contentView).offset(-20);
  48. make.height.greaterThanOrEqualTo(@17);
  49. }];
  50. [self.moreIconV mas_makeConstraints:^(MASConstraintMaker *make) {
  51. make.width.equalTo(@7);
  52. make.height.equalTo(@17);
  53. make.top.equalTo(self.contentView).offset(20);
  54. make.trailing.equalTo(self.contentView).offset(-20);
  55. make.leading.equalTo(self.desLb.mas_trailing).offset(10);
  56. }];
  57. [self.desLb mas_makeConstraints:^(MASConstraintMaker *make) {
  58. make.top.equalTo(self.contentView).offset(20);
  59. make.leading.equalTo(self.titleLb.mas_trailing).offset(10);
  60. make.width.equalTo(@112);
  61. make.height.equalTo(@17);
  62. }];
  63. [self.lineV mas_makeConstraints:^(MASConstraintMaker *make) {
  64. make.leading.equalTo(self.contentView).offset(20);
  65. make.trailing.equalTo(self.contentView).offset(-20);
  66. make.bottom.equalTo(self.contentView);
  67. make.height.equalTo(@1);
  68. }];
  69. [self.desLb setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
  70. [self.titleLb setContentHuggingPriority:UILayoutPriorityFittingSizeLevel forAxis:UILayoutConstraintAxisHorizontal];
  71. [self.titleLb setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisVertical];
  72. }
  73. - (void)awakeFromNib {
  74. [super awakeFromNib];
  75. // Initialization code
  76. }
  77. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  78. [super setSelected:selected animated:animated];
  79. // Configure the view for the selected state
  80. }
  81. - (UILabel *)titleLb {
  82. if (!_titleLb) {
  83. UILabel *lb = [[UILabel alloc] init];
  84. lb.textColor = Col_000;
  85. lb.font = [UIFont fontWithName:Rob_Bold size:14];
  86. lb.textAlignment = NSTextAlignmentLeft;
  87. lb.numberOfLines = 0;
  88. _titleLb = lb;
  89. }
  90. return _titleLb;
  91. }
  92. - (UILabel *)desLb {
  93. if (!_desLb) {
  94. UILabel *lb = [[UILabel alloc] init];
  95. lb.textColor = Col_000;
  96. lb.font = [UIFont fontWithName:Rob_Regular size:14];
  97. lb.textAlignment = NSTextAlignmentRight;
  98. _desLb = lb;
  99. }
  100. return _desLb;
  101. }
  102. - (UIImageView *)moreIconV {
  103. if (!_moreIconV) {
  104. UIImageView *v = [UIImageView new];
  105. v.contentMode = UIViewContentModeScaleAspectFit;
  106. v.image = [UIImage imageNamed:@"uc_more"];
  107. _moreIconV = v;
  108. }
  109. return _moreIconV;
  110. }
  111. - (UIView *)lineV {
  112. if (!_lineV) {
  113. UIView *v = [UIView new];
  114. v.backgroundColor = _043632;
  115. v.alpha = 0.1;
  116. _lineV = v;
  117. }
  118. return _lineV;
  119. }
  120. @end