酷店

KDPShopView.m 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. //
  2. // KDPShopView.m
  3. // KuDianProject
  4. //
  5. // Created by 学丽 on 2019/7/9.
  6. // Copyright © 2019 KDP. All rights reserved.
  7. //
  8. #import "KDPShopView.h"
  9. @implementation KDPShopView
  10. -(instancetype)initWithFrame:(CGRect)frame
  11. {
  12. self=[super initWithFrame:frame];
  13. if (self) {
  14. self.shopimgV=[[UIImageView alloc]initWithFrame:CGRectMake(10, 10, 50, 50)];
  15. self.shopimgV.backgroundColor=[UIColor colorWithHexString:LineColor];
  16. [self addSubview:self.shopimgV];
  17. self.shopLabel=[[UILabel alloc]initWithFrame:CGRectMake(self.shopimgV.right+10, 15, self.width-self.shopimgV.right-10, 20)];
  18. self.shopLabel.textColor=[UIColor colorWithHexString:fontColor];
  19. self.shopLabel.font=[UIFont systemFontOfSize:14];
  20. [self addSubview:self.shopLabel];
  21. self.desclabel=[[UILabel alloc]initWithFrame:CGRectMake(self.shopimgV.right+10, self.shopLabel.bottom+5, self.width-self.shopimgV.right-10, 20)];
  22. self.desclabel.font=[UIFont systemFontOfSize:12];
  23. self.desclabel.textColor=[UIColor colorWithHexString:@"#999999"];
  24. [self addSubview:self.desclabel];
  25. UIView *lineV=[[UIView alloc]init];
  26. lineV.backgroundColor=[UIColor colorWithHexString:LineColor];
  27. [self addSubview:lineV];
  28. [lineV mas_makeConstraints:^(MASConstraintMaker *make) {
  29. make.left.mas_equalTo(0);
  30. make.right.mas_equalTo(0);
  31. make.top.mas_equalTo(self.mas_bottom).offset(-5);
  32. make.height.mas_equalTo(5);
  33. }];
  34. }
  35. return self;
  36. }
  37. -(void)setShopDic:(NSDictionary *)shopDic
  38. {
  39. _shopDic = shopDic;
  40. [self.shopimgV sd_setImageWithURL:[NSURL URLWithString:shopDic[@"pic_path"]]placeholderImage:[UIImage imageNamed:placholderImg]];
  41. self.shopLabel.text=shopDic[@"title"];
  42. self.desclabel.text=[NSString stringWithFormat:@"商品描述:%@ 服务态度:%@ 发货速度:%@",shopDic[@"item_score"],shopDic[@"service_score"],shopDic[@"delivery_score"]];
  43. }
  44. @end