MOTextAlertCell.m 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. //
  2. // MOTextAlertCell.m
  3. // MiMoLive
  4. //
  5. // Created by SuperC on 2023/11/2.
  6. //
  7. #import "MOTextAlertCell.h"
  8. @implementation MOTextAlertCell
  9. #pragma mark - View Cycle
  10. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
  11. {
  12. if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
  13. {
  14. self.selectionStyle = UITableViewCellSelectionStyleNone;
  15. self.backgroundColor = [UIColor clearColor];
  16. self.clipsToBounds = YES;
  17. [self setupUI];
  18. }
  19. return self;
  20. }
  21. - (void)setupUI//设置UI
  22. {
  23. [self.contentView addSubview:self.titleLab];
  24. [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make)
  25. {
  26. make.left.equalTo(self.contentView).offset(15.0);
  27. make.centerY.equalTo(self.contentView).offset(0);
  28. make.right.equalTo(self.contentView).offset(-15.0);
  29. make.height.equalTo(@(20));
  30. }];
  31. UIView *lineView = [[UIView alloc] init];
  32. lineView.backgroundColor = [MOTools colorWithHexString:@"#F0F0F0" alpha:1.0];
  33. [self.contentView addSubview:lineView];
  34. [lineView mas_makeConstraints:^(MASConstraintMaker *make)
  35. {
  36. make.left.equalTo(self.contentView);
  37. make.height.equalTo(@0.5);
  38. make.right.equalTo(self.contentView);
  39. make.bottom.equalTo(self.contentView);
  40. }];
  41. }
  42. - (void)awakeFromNib {
  43. [super awakeFromNib];
  44. // Initialization code
  45. }
  46. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  47. [super setSelected:selected animated:animated];
  48. // Configure the view for the selected state
  49. }
  50. - (UILabel *)titleLab
  51. {
  52. if (!_titleLab)
  53. {
  54. _titleLab = [[UILabel alloc] init];
  55. _titleLab.font = [MOTextTools regularFont:16];
  56. _titleLab.textColor = kBaseTextColor_1;
  57. _titleLab.textAlignment = NSTextAlignmentCenter;
  58. }
  59. return _titleLab;
  60. }
  61. @end