口袋优选

KBShopInfoView.m 2.1KB

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