YOUPAILCCommonCell.m 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. //
  2. // YOUPAILCCommonCell.m
  3. // LiveChat
  4. //
  5. // Created by 张灿 on 2018/4/13.
  6. // Copyright © 2018年 caicai. All rights reserved.
  7. //
  8. #import "YOUPAILCCommonCell.h"
  9. @implementation YOUPAILCCommonCell
  10. - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  11. if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
  12. self.selectionStyle = UITableViewCellSelectionStyleNone;
  13. //v1.5.6 适配暗黑模式
  14. [self.contentView setBackgroundColor:LCWhiteColor];
  15. [self youpaifinitUI];
  16. }
  17. return self;
  18. }
  19. - (void)youpaifinitUI{
  20. self.youpaiparrowImgView = [[UIImageView alloc]init];
  21. self.youpaiparrowImgView.contentMode = UIViewContentModeScaleAspectFill;
  22. self.youpaiparrowImgView.image = [UIImage imageNamed:@"vqu_images_H_cell_arrow_gray"];
  23. [self.contentView addSubview:self.youpaiparrowImgView];
  24. [self.youpaiparrowImgView makeConstraints:^(MASConstraintMaker *make) {
  25. make.right.equalTo(@-15);
  26. make.top.equalTo((self.frame.size.height-13)/2);
  27. make.size.mas_equalTo(CGSizeMake(7, 13));
  28. }];
  29. self.youpaiparrowLabel = [[UILabel alloc]init];
  30. self.youpaiparrowLabel.font = [UIFont systemFontOfSize:13];
  31. self.youpaiparrowLabel.textColor = LCTextGray;
  32. self.youpaiparrowLabel.textAlignment = NSTextAlignmentRight;
  33. [self.contentView addSubview:self.youpaiparrowLabel];
  34. [self.youpaiparrowLabel makeConstraints:^(MASConstraintMaker *make) {
  35. make.right.equalTo(self.youpaiparrowImgView.mas_left).offset(-15);
  36. make.top.equalTo((self.frame.size.height-20)/2);
  37. make.height.equalTo(@20);
  38. }];
  39. self.youpaipheadLabel = [[UILabel alloc]init];
  40. self.youpaipheadLabel.font = [UIFont boldSystemFontOfSize:15];
  41. self.youpaipheadLabel.textColor = LCTextNormal;
  42. self.youpaipheadLabel.textAlignment = NSTextAlignmentLeft;
  43. [self.contentView addSubview:self.youpaipheadLabel];
  44. [self.youpaipheadLabel makeConstraints:^(MASConstraintMaker *make) {
  45. make.left.equalTo(self.contentView.left).offset(15);
  46. make.top.equalTo((self.frame.size.height-20)/2);
  47. make.height.equalTo(@20);
  48. }];
  49. self.youpaipdataLabel = [[UILabel alloc]init];
  50. self.youpaipdataLabel.font = [UIFont systemFontOfSize:14];
  51. self.youpaipdataLabel.textColor = LCTextBlack;
  52. self.youpaipdataLabel.textAlignment = NSTextAlignmentRight;
  53. [self.contentView addSubview:self.youpaipdataLabel];
  54. [self.youpaipdataLabel makeConstraints:^(MASConstraintMaker *make) {
  55. make.left.equalTo(self.youpaipheadLabel.right).offset(20);
  56. make.top.equalTo((self.frame.size.height-20)/2);
  57. make.height.equalTo(@20);
  58. make.right.equalTo(self.youpaiparrowImgView.left).offset(-11);
  59. }];
  60. }
  61. - (void)layoutSubviews{
  62. [self.youpaiparrowImgView updateConstraints:^(MASConstraintMaker *make) {
  63. make.right.equalTo(@-15);
  64. make.top.equalTo((self.frame.size.height-13)/2);
  65. make.size.mas_equalTo(CGSizeMake(7, 13));
  66. }];
  67. [self.youpaiparrowLabel updateConstraints:^(MASConstraintMaker *make) {
  68. make.right.equalTo(self.youpaiparrowImgView.left).offset(-15);
  69. make.top.equalTo((self.frame.size.height-20)/2);
  70. make.height.equalTo(@20);
  71. }];
  72. [self.youpaipheadLabel updateConstraints:^(MASConstraintMaker *make) {
  73. make.left.equalTo(self.contentView.left).offset(15);
  74. make.top.equalTo((self.frame.size.height-20)/2);
  75. make.height.equalTo(@20);
  76. }];
  77. [self.youpaipdataLabel updateConstraints:^(MASConstraintMaker *make) {
  78. make.left.equalTo(self.youpaipheadLabel.right).offset(20);
  79. make.top.equalTo((self.frame.size.height-20)/2);
  80. make.height.equalTo(@20);
  81. }];
  82. }
  83. @end