猎豆优选

LDCommunityShareCell.m 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. //
  2. // LDCommunityShareCell.m
  3. // YouHuiProject
  4. //
  5. // Created by liuxueli on 2018/11/27.
  6. // Copyright © 2018 kuxuan. All rights reserved.
  7. //
  8. #import "LDCommunityShareCell.h"
  9. @implementation LDCommunityShareCell
  10. - (instancetype)initWithFrame:(CGRect)frame
  11. {
  12. self = [super initWithFrame:frame];
  13. if (self) {
  14. self.contentView.backgroundColor = [UIColor whiteColor];
  15. [self initSubViews];
  16. }
  17. return self;
  18. }
  19. -(void)initSubViews
  20. {
  21. [self.contentView addSubview:self.goodImg];
  22. [self.contentView addSubview:self.tipeImg];
  23. [self.contentView addSubview:self.shareLabel];
  24. [self.tipeImg mas_makeConstraints:^(MASConstraintMaker *make) {
  25. make.left.mas_equalTo(FITSIZE(5));
  26. make.width.mas_equalTo(FITSIZE(23));
  27. make.height.mas_equalTo(FITSIZE(26));
  28. }];
  29. [self.goodImg mas_makeConstraints:^(MASConstraintMaker *make) {
  30. make.width.height.mas_equalTo(FITSIZE(106));
  31. }];
  32. [self.shareLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  33. make.width.mas_equalTo(FITSIZE(106));
  34. make.height.mas_equalTo(FITSIZE(30));
  35. make.bottom.mas_equalTo(self.goodImg.bottom);
  36. }];
  37. }
  38. -(void)setModel:(LDCommunityDetailModel *)model
  39. {
  40. _model=model;
  41. _shareLabel.text=[NSString stringWithFormat:@"%@人分享",model.times];
  42. [_goodImg sd_setImageWithURL:[NSURL URLWithString:model.img]];
  43. }
  44. -(UIImageView *)tipeImg
  45. {
  46. if (!_tipeImg) {
  47. _tipeImg =[[UIImageView alloc]init];
  48. }
  49. return _tipeImg;
  50. }
  51. -(UIImageView *)goodImg
  52. {
  53. if (!_goodImg) {
  54. _goodImg =[[UIImageView alloc]init];
  55. }
  56. return _goodImg;
  57. }
  58. -(UILabel *)shareLabel
  59. {
  60. if (!_shareLabel) {
  61. _shareLabel =[[UILabel alloc]init];
  62. _shareLabel.textColor=[UIColor YHColorWithHex:0x6E6E6E];
  63. _shareLabel.textAlignment=NSTextAlignmentCenter;
  64. _shareLabel.font=[UIFont systemFontOfSize:FITSIZE(12)];
  65. }
  66. return _shareLabel;
  67. }
  68. @end