MOImageTitleAlertCell.m 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. //
  2. // POImageTitleAlertCell.m
  3. // powerone
  4. //
  5. // Created by SuperYann on 2023/5/16.
  6. // Copyright © 2023 onecloud.ltd. All rights reserved.
  7. //
  8. #import "MOImageTitleAlertCell.h"
  9. @implementation MOImageTitleAlertCell
  10. #pragma mark - View Cycle
  11. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
  12. {
  13. if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
  14. {
  15. self.selectionStyle = UITableViewCellSelectionStyleNone;
  16. self.backgroundColor = [UIColor clearColor];
  17. self.clipsToBounds = YES;
  18. [self setupUI];
  19. }
  20. return self;
  21. }
  22. - (void)setupUI//设置UI
  23. {
  24. [self.contentView addSubview:self.icon];
  25. [self.icon mas_makeConstraints:^(MASConstraintMaker *make)
  26. {
  27. make.centerX.equalTo(self.contentView).offset(-45.0);
  28. make.centerY.equalTo(self.contentView).offset(0);
  29. make.width.equalTo(@(20.0));
  30. make.height.equalTo(@(20.0));
  31. }];
  32. [self.contentView addSubview:self.titleLab];
  33. [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make)
  34. {
  35. make.left.equalTo(self.icon.mas_right).offset(8.0);
  36. make.centerY.equalTo(self.contentView).offset(0);
  37. make.width.greaterThanOrEqualTo(@(80));
  38. make.height.equalTo(@(20));
  39. }];
  40. UIView *lineView = [[UIView alloc] init];
  41. lineView.backgroundColor = [MOTools colorWithHexString:@"#F0F0F0" alpha:1.0];
  42. [self.contentView addSubview:lineView];
  43. [lineView mas_makeConstraints:^(MASConstraintMaker *make)
  44. {
  45. make.left.equalTo(self.contentView);
  46. make.height.equalTo(@0.5);
  47. make.right.equalTo(self.contentView);
  48. make.bottom.equalTo(self.contentView);
  49. }];
  50. }
  51. - (UIImageView *)icon
  52. {
  53. if (!_icon)
  54. {
  55. _icon = [[UIImageView alloc] init];
  56. _icon.layer.masksToBounds = YES;
  57. }
  58. return _icon;
  59. }
  60. - (UILabel *)titleLab
  61. {
  62. if (!_titleLab)
  63. {
  64. _titleLab = [[UILabel alloc] init];
  65. _titleLab.font = [UIFont systemFontOfSize:14.0];
  66. _titleLab.textColor = [MOTools colorWithHexString:@"#000000" alpha:1.0];
  67. _titleLab.textAlignment = NSTextAlignmentLeft;
  68. }
  69. return _titleLab;
  70. }
  71. - (void)awakeFromNib
  72. {
  73. [super awakeFromNib];
  74. // Initialization code
  75. }
  76. - (void)setSelected:(BOOL)selected animated:(BOOL)animated
  77. {
  78. [super setSelected:selected animated:animated];
  79. // Configure the view for the selected state
  80. }
  81. @end