// // KBShopInfoView.m // YouHuiProject // // Created by 小花 on 2018/7/13. // Copyright © 2018年 kuxuan. All rights reserved. // #import "KBShopInfoView.h" @interface KBShopInfoView () { KBShopModel *shopModel; } @property (nonatomic, strong) UIImageView *icon; @property (nonatomic, strong) UILabel *shopName; @end @implementation KBShopInfoView - (instancetype)initWithFrame:(CGRect)frame shopModel:(KBShopModel *)model{ self = [super initWithFrame:frame]; if (self) { shopModel = model; 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.icon sd_setImageWithURL:[NSURL URLWithString:shopModel.pic_path] placeholderImage:Placehold_Img]; [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.shopName.text = shopModel.title; [self addSubview:self.shopName]; CGFloat width = (self.width-self.icon.right-20)/3; CGFloat margin = self.icon.right+10; NSArray *titles = @[[NSString stringWithFormat:@"商品描述:%@",shopModel.item_score], [NSString stringWithFormat:@"服务态度:%@",shopModel.service_score], [NSString stringWithFormat:@"发货速度:%@",shopModel.delivery_score], ]; 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.text = titles[i]; [self addSubview:label]; } } @end