// // KBShopInfoView.m // YouHuiProject // // Created by 小花 on 2018/7/13. // Copyright © 2018年 kuxuan. All rights reserved. // #import "KBShopInfoView.h" @interface KBShopInfoView () { } @property (nonatomic, strong) UIImageView *icon; @property (nonatomic, strong) UILabel *shopName; @end @implementation KBShopInfoView - (instancetype)initWithFrame:(CGRect)frame{ self = [super initWithFrame:frame]; if (self) { self.backgroundColor = [UIColor whiteColor]; [self initSubViews]; self.layer.masksToBounds = YES; } return self; } - (void)initSubViews { self.icon = [[UIImageView alloc] initWithFrame:CGRectMake(Fitsize(15), Fitsize(10), Fitsize(47), Fitsize(47))]; self.icon.backgroundColor = [UIColor yhGrayColor]; [self addSubview:self.icon]; self.shopName = [[UILabel alloc] initWithFrame:CGRectMake(self.icon.right+10, Fitsize(13), Fitsize(230), Fitsize(20))]; self.shopName.font = [UIFont systemFontOfSize:Fitsize(16)]; self.shopName.textColor = [UIColor YHColorWithHex:0x333333]; [self addSubview:self.shopName]; CGFloat width = (self.width-self.icon.right-20)/3; CGFloat margin = self.icon.right+10; for (int i = 0; i < 3; i++) { UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(margin+width*i, self.icon.bottom-Fitsize(14), width, Fitsize(14))]; label.textColor = [UIColor YHColorWithHex:0x919090]; label.font = [UIFont systemFontOfSize:Fitsize(12)]; label.tag = 1000+i; [self addSubview:label]; } } - (void)setShopInfo:(KBShopModel *)model { [self.icon sd_setImageWithURL:[NSURL URLWithString:model.pic_path]]; self.shopName.text = model.title; NSArray *titles = @[[NSString stringWithFormat:@"商品描述:%@",model.item_score], [NSString stringWithFormat:@"服务态度:%@",model.service_score], [NSString stringWithFormat:@"发货速度:%@",model.delivery_score], ]; for (int i = 0; i < 3; i++) { UILabel *label = [self viewWithTag:1000+i]; label.text = titles[i]; } } @end