省钱达人

DRShopInfoView.m 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. //
  2. // DRShopInfoView.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/7/13.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "DRShopInfoView.h"
  9. @interface DRShopInfoView ()
  10. {
  11. DRShopModel *shopModel;
  12. }
  13. @property (nonatomic, strong) UIImageView *icon;
  14. @property (nonatomic, strong) UILabel *shopName;
  15. @end
  16. @implementation DRShopInfoView
  17. - (instancetype)initWithFrame:(CGRect)frame shopModel:(DRShopModel *)model{
  18. self = [super initWithFrame:frame];
  19. if (self) {
  20. shopModel = model;
  21. self.backgroundColor = [UIColor whiteColor];
  22. [self initSubViews];
  23. self.layer.masksToBounds = YES;
  24. }
  25. return self;
  26. }
  27. - (void)initSubViews {
  28. self.icon = [[UIImageView alloc] initWithFrame:CGRectMake(Fitsize(15), Fitsize(10), Fitsize(47), Fitsize(47))];
  29. self.icon.backgroundColor = [UIColor yhGrayColor];
  30. [self.icon sd_setImageWithURL:[NSURL URLWithString:shopModel.pic_path] placeholderImage:Placehold_Img];
  31. [self addSubview:self.icon];
  32. self.shopName = [[UILabel alloc] initWithFrame:CGRectMake(self.icon.right+10, Fitsize(13), Fitsize(230), Fitsize(20))];
  33. self.shopName.font = [UIFont systemFontOfSize:Fitsize(16)];
  34. self.shopName.textColor = [UIColor YHColorWithHex:0x333333];
  35. self.shopName.text = shopModel.title;
  36. [self addSubview:self.shopName];
  37. CGFloat width = (self.width-self.icon.right-20)/3;
  38. CGFloat margin = self.icon.right+10;
  39. NSArray *titles = @[[NSString stringWithFormat:@"商品描述:%@",shopModel.item_score],
  40. [NSString stringWithFormat:@"服务态度:%@",shopModel.service_score],
  41. [NSString stringWithFormat:@"发货速度:%@",shopModel.delivery_score],
  42. ];
  43. for (int i = 0; i < 3; i++) {
  44. UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(margin+width*i, self.icon.bottom-Fitsize(14), width, Fitsize(14))];
  45. label.textColor = [UIColor YHColorWithHex:0x919090];
  46. label.font = [UIFont systemFontOfSize:Fitsize(12)];
  47. label.text = titles[i];
  48. [self addSubview:label];
  49. }
  50. }
  51. @end