// // KBNativeShopCarHeader.m // YouHuiProject // // Created by 小花 on 2018/11/6. // Copyright © 2018年 kuxuan. All rights reserved. // #import "KBNativeShopCarHeader.h" @interface KBNativeShopCarHeader () @end @implementation KBNativeShopCarHeader - (instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { self.backgroundColor = [UIColor changeColor]; [self initSubViews]; } return self; } - (void)initSubViews { // NSArray *titles = @[@"发现宝贝",@"隐藏优惠券",@"可省钱"]; // CGFloat width = (SCREEN_WIDTH)/3; // for (int i = 0; i < titles.count; i++) { // UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(width*i, 5, width, 18)]; // titleLabel.textAlignment = NSTextAlignmentCenter; // titleLabel.textColor = [UIColor whiteColor]; // titleLabel.font = [UIFont systemFontOfSize:13]; // titleLabel.text = titles[i]; // [self addSubview:titleLabel]; // // UILabel *detailLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH/3, 22)]; // detailLabel.y = titleLabel.bottom; // detailLabel.centerX = titleLabel.centerX; // detailLabel.textColor = [UIColor whiteColor]; // detailLabel.textAlignment = NSTextAlignmentCenter; // detailLabel.font = [UIFont boldSystemFontOfSize:15]; // detailLabel.tag = 1000+i; // [self addSubview:detailLabel]; // // } self.backgroundColor = [UIColor whiteColor]; self.layer.cornerRadius=FITSIZE(2); self.layer.masksToBounds=YES; UIImageView *img = [[UIImageView alloc] initWithFrame:CGRectMake(8, 0, 18, 18)]; img.image = [UIImage imageNamed:@"sheng"]; img.centerY = self.height/2; [self addSubview:img]; UILabel *textLb = [[UILabel alloc] initWithFrame:CGRectMake(img.right+5, 0, self.width-40, self.height)]; textLb.text = @"已帮您筛选出有优惠券的宝贝,可省xxx元"; textLb.textColor = [UIColor homeRedColor]; textLb.font = [UIFont systemFontOfSize:Fitsize(12)]; textLb.tag = 1000; [self addSubview:textLb]; } - (void)setDataWithDic:(id)dict { NSString *count = [NSString stringWithFormat:@"%@件",dict[@"allGoodsNum"]]; NSString *allCoupon = [NSString stringWithFormat:@"%@张",dict[@"allCouponsGoods"]]; NSString *totalCouponMoney = [NSString stringWithFormat:@"%@元",dict[@"totalCouponMoney"]]; NSArray *titles = @[count, allCoupon, totalCouponMoney]; for (int i = 0; i < titles.count; i++) { UILabel *label = [self viewWithTag:1000+i]; label.text = titles[i]; } } -(void)setTotalMoney:(NSString *)totalMoney { UILabel *textL =[self viewWithTag:1000]; textL.text=[NSString stringWithFormat:@"已帮您筛选出有优惠券的宝贝,可省%.2f元",totalMoney.floatValue]; } @end