CategoryCell.m 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. //
  2. // CategoryCell.m
  3. // jitao
  4. //
  5. // Created by 罗云飞 on 2017/12/7.
  6. // Copyright © 2017年 罗云飞. All rights reserved.
  7. //
  8. #import "CategoryCell.h"
  9. @implementation CategoryCell
  10. - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  11. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  12. if (self) {
  13. self.backgroundColor = NewNavigationColor;
  14. UIView *view = [UIView new];
  15. view.backgroundColor = NewWhiteColor;
  16. ViewRadius(view, 5);
  17. [self.contentView addSubview:view];
  18. view.sd_layout
  19. .leftSpaceToView(self.contentView, 15)
  20. .topEqualToView(self.contentView)
  21. .heightIs(fitScreenWidth(44))
  22. .rightSpaceToView(self.contentView, 15);
  23. _image = [UIImageView new];
  24. // _image.backgroundColor = NewRedColor;
  25. [view addSubview:_image];
  26. _image.sd_layout
  27. .leftSpaceToView(view, fitScreenWidth(12))
  28. .centerYEqualToView(view)
  29. .heightIs(fitScreenWidth(16))
  30. .widthIs(fitScreenWidth(16));
  31. _name = [UILabel new];
  32. _name.font = NewFont(fitScreenWidth(14));
  33. [_name setSingleLineAutoResizeWithMaxWidth:0];
  34. _name.textColor = NewBlackColor;
  35. [view addSubview:_name];
  36. _name.sd_layout
  37. .leftSpaceToView(_image, 10)
  38. .centerYEqualToView(view)
  39. .heightIs(fitScreenHeight(13));
  40. _seedetails = [UILabel new];
  41. _seedetails.textColor = [UIColor colorWithString:@"#9A9A9A"];
  42. _seedetails.font = NewFont(fitScreenWidth(12));
  43. [_seedetails setSingleLineAutoResizeWithMaxWidth:0];
  44. [view addSubview:_seedetails];
  45. _seedetails.sd_layout
  46. .centerYEqualToView(view)
  47. .rightSpaceToView(view, 30)
  48. .heightIs(fitScreenHeight(12));
  49. _line = [UILabel new];
  50. _line.backgroundColor = NewLineGrayColor;
  51. [view addSubview:_line];
  52. _line.sd_layout
  53. .bottomEqualToView(view)
  54. .leftEqualToView(view)
  55. .rightEqualToView(view)
  56. .heightIs(0.6);
  57. _backimage = [UIImageView new];
  58. [_backimage setImage:[UIImage imageNamed:@"括号"]];
  59. // backimage.backgroundColor = NewRedColor;
  60. [view addSubview:_backimage];
  61. _backimage.sd_layout
  62. .rightSpaceToView(view, 15)
  63. .centerYEqualToView(view)
  64. .heightIs(fitScreenWidth(13))
  65. .widthIs(fitScreenWidth(7));
  66. }
  67. return self;
  68. }
  69. - (void)assignment:(NSDictionary *)model {
  70. _name.text = model[@"nameKey"];
  71. _seedetails.text = @"查看详情";
  72. [_image setImage:[UIImage imageNamed:model[@"imageKey"]]];
  73. }
  74. - (void)awakeFromNib {
  75. [super awakeFromNib];
  76. // Initialization code
  77. }
  78. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  79. [super setSelected:selected animated:animated];
  80. // Configure the view for the selected state
  81. }
  82. @end