No Description

KXCreditCardTableViewCell.m 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. //
  2. // KXCreditCardTableViewCell.m
  3. // CAISHEN
  4. //
  5. // Created by xiaoxi on 2017/12/1.
  6. // Copyright © 2017年 kuxuan. All rights reserved.
  7. //
  8. #import "KXCreditCardTableViewCell.h"
  9. #import "KXCreditCardModel.h"
  10. @implementation KXCreditCardTableViewCell
  11. - (void)awakeFromNib {
  12. [super awakeFromNib];
  13. // Initialization code
  14. }
  15. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  16. [super setSelected:selected animated:animated];
  17. // Configure the view for the selected state
  18. }
  19. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  20. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  21. if (self) {
  22. self.selectionStyle = UITableViewCellSelectionStyleNone;
  23. [self setupUI];
  24. }
  25. return self;
  26. }
  27. - (void)setupUI {
  28. self.leftBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  29. [self.leftBtn setImage:[UIImage imageNamed:@"mine_footer_normal"] forState:UIControlStateNormal];
  30. [self.leftBtn setImage:[UIImage imageNamed:@"mine_footer_select"] forState:UIControlStateSelected];
  31. [self.contentView addSubview:self.leftBtn];
  32. self.iconView = [[UIImageView alloc] initWithFrame:CGRectZero];
  33. self.iconView.backgroundColor = [UIColor whiteColor];
  34. [self.contentView addSubview:self.iconView];
  35. self.nameView = [[UILabel alloc] initWithFrame:CGRectZero];
  36. self.nameView.backgroundColor = [UIColor whiteColor];
  37. self.nameView.textColor = [UIColor titleColor];
  38. self.nameView.font = FONT_SYS(16*SCREEN_MUTI);
  39. [self.contentView addSubview:self.nameView];
  40. self.adView = [[UILabel alloc] initWithFrame:CGRectZero];
  41. self.adView.backgroundColor = [UIColor whiteColor];
  42. self.adView.textColor = [UIColor KXColorWithHex:0x666666];
  43. self.adView.font = FONT_SYS(12*SCREEN_MUTI);
  44. [self.contentView addSubview:self.adView];
  45. self.personsView = [[UILabel alloc] initWithFrame:CGRectZero];
  46. self.personsView.backgroundColor = [UIColor whiteColor];
  47. self.personsView.font = FONT_SYS(12*SCREEN_MUTI);
  48. [self.contentView addSubview:self.personsView];
  49. self.lineView = [[UILabel alloc] initWithFrame:CGRectZero];
  50. self.lineView.backgroundColor = [UIColor KXColorWithHex:0xf0f0f0];
  51. [self.contentView addSubview:self.lineView];
  52. [self setupConstraints];
  53. }
  54. - (void)setupConstraints {
  55. [self.leftBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  56. make.right.equalTo(self.contentView.mas_left).offset(-10);
  57. make.centerY.equalTo(self.contentView.mas_centerY);
  58. }];
  59. [self.iconView mas_makeConstraints:^(MASConstraintMaker *make) {
  60. make.left.equalTo(self.contentView).offset(14);
  61. make.centerY.equalTo(self.contentView);
  62. make.size.mas_equalTo(CGSizeMake(90*SCREEN_MUTI, 56*SCREEN_MUTI));
  63. }];
  64. [self.nameView mas_makeConstraints:^(MASConstraintMaker *make) {
  65. make.left.equalTo(self.iconView.mas_right).offset(10);
  66. make.top.equalTo(self.iconView.mas_top);
  67. make.right.equalTo(self.contentView);
  68. }];
  69. [self.adView mas_makeConstraints:^(MASConstraintMaker *make) {
  70. make.left.equalTo(self.nameView);
  71. make.centerY.equalTo(self.contentView);
  72. make.right.equalTo(self.nameView);
  73. }];
  74. [self.personsView mas_makeConstraints:^(MASConstraintMaker *make) {
  75. make.left.equalTo(self.nameView);
  76. make.bottom.equalTo(self.contentView).offset(-18*SCREEN_MUTI);
  77. make.right.equalTo(self.nameView);
  78. }];
  79. [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
  80. make.left.equalTo(self.contentView).offset(14);
  81. make.bottom.equalTo(self.contentView).offset(-0.5);
  82. make.right.equalTo(self.contentView).offset(-14);
  83. make.height.mas_equalTo(0.5);
  84. }];
  85. }
  86. @end