MineViewCell.m 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. //
  2. // MineViewCell.m
  3. // VclustersGemini
  4. //
  5. // Created by 黄盛威 on 2020/10/19.
  6. // Copyright © 2020 APPLE. All rights reserved.
  7. //
  8. #import "MineViewCell.h"
  9. @implementation MineViewCell
  10. @synthesize cellBgView;
  11. @synthesize mImageView;
  12. @synthesize titleLabel;
  13. @synthesize titleLabel2;
  14. @synthesize rightImage;
  15. @synthesize lineView;
  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. /**标题*/
  63. titleLabel = [[UILabel alloc] init];
  64. [cellBgView addSubview:titleLabel];
  65. titleLabel.font = [UIFont systemFontOfSize:13.f];
  66. [titleLabel setTextColor:HW0A132BColor];
  67. [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  68. make.left.equalTo(mImageView.mas_right).offset(5.f);
  69. make.right.mas_equalTo(-100.f);
  70. make.centerY.equalTo(cellBgView.mas_centerY);
  71. }];
  72. /**副标题*/
  73. titleLabel2 = [[UILabel alloc] init];
  74. [cellBgView addSubview:titleLabel2];
  75. titleLabel2.font = [UIFont systemFontOfSize:12.f];
  76. [titleLabel2 setTextAlignment:(NSTextAlignmentRight)];
  77. [titleLabel2 setTextColor:HW666666Color];
  78. [titleLabel2 mas_makeConstraints:^(MASConstraintMaker *make) {
  79. make.right.mas_equalTo(-53.f);
  80. make.left.mas_equalTo(100.f);
  81. make.centerY.equalTo(cellBgView.mas_centerY);
  82. }];
  83. lineView = [[UIView alloc] init];
  84. [lineView setBackgroundColor:HW979797Color10];
  85. [cellBgView addSubview:lineView];
  86. [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
  87. make.right.mas_equalTo(-15.f);
  88. make.left.mas_equalTo(15.f);
  89. make.bottom.mas_equalTo(0);
  90. make.height.mas_equalTo(1.f);
  91. }];
  92. }
  93. @end