YOUPAILCSkillCollectionCell.m 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. //
  2. // YOUPAILCSkillCollectionCell.m
  3. // LiveChat
  4. //
  5. // Created by 张灿 on 2018/9/9.
  6. // Copyright © 2018年 caicai. All rights reserved.
  7. //
  8. #import "YOUPAILCSkillCollectionCell.h"
  9. @interface YOUPAILCSkillCollectionCell()
  10. @end
  11. @implementation YOUPAILCSkillCollectionCell
  12. - (instancetype)initWithFrame:(CGRect)frame {
  13. self = [super initWithFrame:frame];
  14. if (self) {
  15. self.backgroundColor = [UIColor clearColor];
  16. [self youpaifsetupView];
  17. }
  18. return self;
  19. }
  20. - (void)youpaifsetupView{
  21. self.youpaipiconImgView = [[UIImageView alloc]init];
  22. self.youpaipiconImgView.contentMode = UIViewContentModeScaleAspectFill;
  23. self.youpaipiconImgView.alpha = 0.3;
  24. [self addSubview:self.youpaipiconImgView];
  25. [self.youpaipiconImgView makeConstraints:^(MASConstraintMaker *make) {
  26. make.centerX.equalTo(self.centerX);
  27. make.centerY.equalTo(self.centerY).offset(-12);
  28. make.size.mas_equalTo(CGSizeMake(42, 42));
  29. }];
  30. self.youpaipselectImgView = [[UIImageView alloc]init];
  31. self.youpaipselectImgView.contentMode = UIViewContentModeScaleAspectFill;
  32. self.youpaipselectImgView.image = [UIImage imageNamed:@"vqu_images_skill_select"];
  33. [self addSubview:self.youpaipselectImgView];
  34. [self.youpaipselectImgView makeConstraints:^(MASConstraintMaker *make) {
  35. make.left.equalTo(self.youpaipiconImgView.right).offset(-5);
  36. make.bottom.equalTo(self.youpaipiconImgView.top).offset(10);
  37. make.size.mas_equalTo(CGSizeMake(18, 18));
  38. }];
  39. UILabel* statuLabel = [[UILabel alloc]init];
  40. statuLabel.textColor = [UIColor whiteColor];
  41. statuLabel.font = LCFont(11);
  42. statuLabel.textAlignment = NSTextAlignmentCenter;
  43. statuLabel.hidden = YES;
  44. statuLabel.layer.cornerRadius = 10;
  45. statuLabel.layer.masksToBounds = YES;
  46. [self addSubview:statuLabel];
  47. self.youpaipstatuLabel = statuLabel;
  48. [statuLabel makeConstraints:^(MASConstraintMaker *make) {
  49. make.top.equalTo(self.youpaipiconImgView.top).offset(-10);
  50. make.left.equalTo(self.youpaipiconImgView.right).offset(-25);
  51. make.size.mas_equalTo(CGSizeMake(50, 20));
  52. }];
  53. UILabel* skillNameLabel = [[UILabel alloc]init];
  54. skillNameLabel.alpha = 0.3;
  55. skillNameLabel.textColor = LCTextNormal;
  56. skillNameLabel.font = LCFont(13);
  57. skillNameLabel.textAlignment = NSTextAlignmentCenter;
  58. [self addSubview:skillNameLabel];
  59. self.youpaipskillNameLabel = skillNameLabel;
  60. [skillNameLabel makeConstraints:^(MASConstraintMaker *make) {
  61. make.top.equalTo(self.youpaipiconImgView.bottom).offset(@5);
  62. make.height.equalTo(@20);
  63. make.width.equalTo(self.width);
  64. }];
  65. }
  66. - (void)setYoupaipskillModel:(YOUPAILCSkillModel *)skillModel{
  67. _youpaipskillModel = skillModel;
  68. self.youpaipselectImgView.hidden = YES;
  69. [self.youpaipiconImgView sd_setImageWithURL:[LCTools getImageUrlWithAddress:skillModel.youpaipicon]];
  70. self.youpaipskillNameLabel.text = skillModel.youpaipname;
  71. if (skillModel.youpaipis_add == 1) {
  72. self.youpaipiconImgView.alpha = 1.0;
  73. self.youpaipskillNameLabel.alpha = 1.0;
  74. self.youpaipstatuLabel.hidden = NO;
  75. self.youpaipstatuLabel.text = @"已通过";
  76. self.youpaipstatuLabel.backgroundColor = LCGreen;
  77. }
  78. }
  79. @end