《省钱达人》与《猎豆优选》UI相同版。域名tbk

KBNativeShopCarHeader.m 2.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. //
  2. // KBNativeShopCarHeader.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/11/6.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "KBNativeShopCarHeader.h"
  9. @interface KBNativeShopCarHeader ()
  10. @end
  11. @implementation KBNativeShopCarHeader
  12. - (instancetype)initWithFrame:(CGRect)frame
  13. {
  14. self = [super initWithFrame:frame];
  15. if (self) {
  16. self.backgroundColor = [UIColor changeColor];
  17. [self initSubViews];
  18. }
  19. return self;
  20. }
  21. - (void)initSubViews {
  22. // NSArray *titles = @[@"发现宝贝",@"隐藏优惠券",@"可省钱"];
  23. // CGFloat width = (SCREEN_WIDTH)/3;
  24. // for (int i = 0; i < titles.count; i++) {
  25. // UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(width*i, 5, width, 18)];
  26. // titleLabel.textAlignment = NSTextAlignmentCenter;
  27. // titleLabel.textColor = [UIColor whiteColor];
  28. // titleLabel.font = [UIFont systemFontOfSize:13];
  29. // titleLabel.text = titles[i];
  30. // [self addSubview:titleLabel];
  31. //
  32. // UILabel *detailLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH/3, 22)];
  33. // detailLabel.y = titleLabel.bottom;
  34. // detailLabel.centerX = titleLabel.centerX;
  35. // detailLabel.textColor = [UIColor whiteColor];
  36. // detailLabel.textAlignment = NSTextAlignmentCenter;
  37. // detailLabel.font = [UIFont boldSystemFontOfSize:15];
  38. // detailLabel.tag = 1000+i;
  39. // [self addSubview:detailLabel];
  40. //
  41. // }
  42. self.backgroundColor = [UIColor whiteColor];
  43. self.layer.cornerRadius=FITSIZE(2);
  44. self.layer.masksToBounds=YES;
  45. UIImageView *img = [[UIImageView alloc] initWithFrame:CGRectMake(8, 0, 18, 18)];
  46. img.image = [UIImage imageNamed:@"sheng"];
  47. img.centerY = self.height/2;
  48. [self addSubview:img];
  49. UILabel *textLb = [[UILabel alloc] initWithFrame:CGRectMake(img.right+5, 0, self.width-40, self.height)];
  50. textLb.text = @"已帮您筛选出有优惠券的宝贝,可省xxx元";
  51. textLb.textColor = [UIColor homeRedColor];
  52. textLb.font = [UIFont systemFontOfSize:Fitsize(12)];
  53. textLb.tag = 1000;
  54. [self addSubview:textLb];
  55. }
  56. - (void)setDataWithDic:(id)dict {
  57. NSString *count = [NSString stringWithFormat:@"%@件",dict[@"allGoodsNum"]];
  58. NSString *allCoupon = [NSString stringWithFormat:@"%@张",dict[@"allCouponsGoods"]];
  59. NSString *totalCouponMoney = [NSString stringWithFormat:@"%@元",dict[@"totalCouponMoney"]];
  60. NSArray *titles = @[count, allCoupon, totalCouponMoney];
  61. for (int i = 0; i < titles.count; i++) {
  62. UILabel *label = [self viewWithTag:1000+i];
  63. label.text = titles[i];
  64. }
  65. }
  66. -(void)setTotalMoney:(NSString *)totalMoney
  67. {
  68. UILabel *textL =[self viewWithTag:1000];
  69. textL.text=[NSString stringWithFormat:@"已帮您筛选出有优惠券的宝贝,可省%.2f元",totalMoney.floatValue];
  70. }
  71. @end