FavoritesTextCell.m 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. //
  2. // FavoritesTextCell.m
  3. // AIIM
  4. //
  5. // Created by qitewei on 2025/4/30.
  6. //
  7. #import "FavoritesTextCell.h"
  8. #import "CryptoAES.h"
  9. @interface FavoritesTextCell()
  10. @property (nonatomic, strong) UILabel * contentLbl;
  11. @property (nonatomic, strong) UILabel * timeLbl;
  12. @end
  13. @implementation FavoritesTextCell
  14. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  15. if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
  16. [self configUI];
  17. }
  18. return self;
  19. }
  20. - (void)configUI{
  21. self.contentView.backgroundColor = globalColor(GCTypeDark6);
  22. [self.contentView addSubview:self.contentLbl];
  23. [self.contentView addSubview:self.timeLbl];
  24. UIEdgeInsets padding = UIEdgeInsetsMake(16, 20, 16, 20);
  25. [self.contentLbl mas_makeConstraints:^(MASConstraintMaker *make) {
  26. make.left.equalTo(self.contentView.mas_left).offset(padding.left);
  27. make.right.equalTo(self.contentView.mas_right).offset(-padding.right);
  28. make.top.equalTo(self.contentView.mas_top).offset(padding.top);
  29. }];
  30. [self.timeLbl mas_makeConstraints:^(MASConstraintMaker *make) {
  31. make.top.equalTo(self.contentLbl.mas_bottom).offset(12);
  32. make.left.equalTo(self.contentView.mas_left).offset(padding.left);
  33. make.right.equalTo(self.contentView.mas_right).offset(-padding.right);
  34. make.bottom.equalTo(self.contentView.mas_bottom).offset(-padding.bottom);
  35. make.height.equalTo(@12);
  36. }];
  37. }
  38. - (void)setMsg:(NSDictionary *)msg{
  39. self.contentLbl.text = [CryptoAES.shareInstance decryptDataL:msg[@"content"]];
  40. self.timeLbl.text = msg[@"createTime"];
  41. }
  42. #pragma mark lazy
  43. - (UILabel *)contentLbl{
  44. if (!_contentLbl) {
  45. _contentLbl = [[UILabel alloc] init];
  46. _contentLbl.textColor = UIColor.whiteColor;
  47. _contentLbl.font = [UIFont systemFontOfSize:14 weight:UIFontWeightRegular];
  48. _contentLbl.numberOfLines = 4;
  49. }
  50. return _contentLbl;
  51. }
  52. - (UILabel *)timeLbl{
  53. if (!_timeLbl) {
  54. _timeLbl = [[UILabel alloc] init];
  55. _timeLbl.textColor = globalColor(GCTypeDark7);
  56. _timeLbl.font = [UIFont systemFontOfSize:12 weight:UIFontWeightRegular];
  57. }
  58. return _timeLbl;
  59. }
  60. @end