fileSetTableViewCell.m 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. //
  2. // fileSetTableViewCell.m
  3. // 隐私保护
  4. //
  5. // Created by xd h on 2023/12/28.
  6. //
  7. #import "fileSetTableViewCell.h"
  8. @implementation fileSetTableViewCell
  9. @synthesize cellBgView;
  10. @synthesize mImageView;
  11. @synthesize titleLabel;
  12. @synthesize titleLabel2;
  13. @synthesize rightImage;
  14. @synthesize lineView;
  15. @synthesize maskSwitch;
  16. - (void)awakeFromNib {
  17. [super awakeFromNib];
  18. // Initialization code
  19. }
  20. - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
  21. {
  22. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  23. if (self)
  24. {
  25. [self drawView];
  26. }
  27. return self;
  28. }
  29. - (void)drawView
  30. {
  31. cellBgView = [[UIView alloc] init];
  32. [self.contentView addSubview:cellBgView];
  33. cellBgView.backgroundColor = [UIColor whiteColor];
  34. [cellBgView mas_makeConstraints:^(MASConstraintMaker *make) {
  35. make.left.mas_equalTo(15.f);
  36. make.top.mas_equalTo(0);
  37. make.bottom.mas_equalTo(0);
  38. make.width.mas_equalTo(SCREEN_W - 2*15.f);
  39. }];
  40. /*图片*/
  41. mImageView = [[UIImageView alloc] init];
  42. [mImageView setBackgroundColor:[UIColor clearColor]];
  43. [cellBgView addSubview:mImageView];
  44. [mImageView setContentMode:(UIViewContentModeScaleAspectFill)];
  45. [mImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  46. make.left.mas_equalTo(15);
  47. make.width.mas_equalTo(28);
  48. make.height.mas_equalTo(28);
  49. make.centerY.equalTo(cellBgView.mas_centerY);
  50. }];
  51. /*右侧箭头*/
  52. rightImage = [[UIImageView alloc] init];
  53. [rightImage setBackgroundColor:[UIColor clearColor]];
  54. [rightImage setImage:[UIImage imageNamed:@"cell_right_access"]];
  55. [cellBgView addSubview:rightImage];
  56. [rightImage mas_makeConstraints:^(MASConstraintMaker *make) {
  57. make.width.mas_equalTo(28);
  58. make.right.mas_equalTo(-15.f);
  59. make.height.mas_equalTo(28);
  60. make.centerY.equalTo(cellBgView.mas_centerY);
  61. }];
  62. maskSwitch = [[UISwitch alloc] init];
  63. [cellBgView addSubview:maskSwitch];
  64. [maskSwitch mas_makeConstraints:^(MASConstraintMaker *make) {
  65. make.right.mas_equalTo(-18.f);
  66. make.centerY.equalTo(cellBgView.mas_centerY);
  67. }];
  68. [maskSwitch setOnTintColor:HW13B2EBColor];
  69. [maskSwitch addTarget:self action:@selector(maskSwitchPressed:) forControlEvents:(UIControlEventValueChanged)];
  70. BOOL haveOpenMask = [HWDataManager getBoolWithKey:Consn_Fanzhuan_Exit_app_Open];
  71. [maskSwitch setOn:haveOpenMask];
  72. /**标题*/
  73. titleLabel = [[UILabel alloc] init];
  74. [cellBgView addSubview:titleLabel];
  75. titleLabel.font = [UIFont boldSystemFontOfSize:14.f];
  76. [titleLabel setTextColor:HW0A132BColor];
  77. [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  78. //make.left.equalTo(mImageView.mas_right).offset(5.f);
  79. make.left.mas_equalTo(10.f);
  80. make.right.mas_equalTo(-50.f);
  81. make.centerY.equalTo(cellBgView.mas_centerY);
  82. }];
  83. /**副标题*/
  84. titleLabel2 = [[UILabel alloc] init];
  85. [cellBgView addSubview:titleLabel2];
  86. titleLabel2.font = [UIFont systemFontOfSize:12.f];
  87. [titleLabel2 setTextAlignment:(NSTextAlignmentRight)];
  88. [titleLabel2 setTextColor:HW666666Color];
  89. [titleLabel2 mas_makeConstraints:^(MASConstraintMaker *make) {
  90. make.right.mas_equalTo(-53.f);
  91. make.left.mas_equalTo(100.f);
  92. make.centerY.equalTo(cellBgView.mas_centerY);
  93. }];
  94. lineView = [[UIView alloc] init];
  95. [lineView setBackgroundColor:HW979797Color10];
  96. [cellBgView addSubview:lineView];
  97. [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
  98. make.right.mas_equalTo(-15.f);
  99. make.left.mas_equalTo(15.f);
  100. make.bottom.mas_equalTo(0);
  101. make.height.mas_equalTo(1.f);
  102. }];
  103. }
  104. - (void)maskSwitchPressed:(UISwitch *)maskSwitch{
  105. if(_didClickSwitch){
  106. _didClickSwitch(maskSwitch.on);
  107. }
  108. }
  109. @end