省钱达人

DRDetailGuideView.m 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. //
  2. // DRDetailGuideView.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/7/13.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "DRDetailGuideView.h"
  9. @implementation DRDetailGuideView
  10. - (instancetype)initWithFrame:(CGRect)frame {
  11. self = [super initWithFrame:frame];
  12. if (self) {
  13. self.backgroundColor = [UIColor yhGrayColor];
  14. [self initSubViews];
  15. }
  16. return self;
  17. }
  18. - (void)initSubViews {
  19. UIImageView *icon = [[UIImageView alloc] initWithFrame:CGRectMake(16, 0, 17, 15)];
  20. icon.centerY = self.height/2;
  21. icon.image = [UIImage imageNamed:@"money_de"];
  22. icon.userInteractionEnabled = YES;
  23. [self addSubview:icon];
  24. UILabel *des = [[UILabel alloc] initWithFrame:CGRectMake(icon.right+5, 0, SCREEN_WIDTH-50, self.height)];
  25. des.userInteractionEnabled = YES;
  26. des.textColor = [UIColor homeRedColor];
  27. des.text = @"您自己购买可得佣金,您分享商品被别人购买也得佣金!";
  28. des.font = [UIFont systemFontOfSize:12];
  29. des.numberOfLines = 2;
  30. [self addSubview:des];
  31. UIImageView *img = [[UIImageView alloc] initWithFrame:CGRectMake(self.width-7-15, 0, 7, 12)];
  32. img.image = [UIImage imageNamed:@"next_right"];
  33. img.centerY = self.height/2;
  34. [self addSubview:img];
  35. UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapViewAction)];
  36. [self addGestureRecognizer:tap];
  37. }
  38. - (void)tapViewAction {
  39. [MobClick event:GoodsDetailVipInfo];
  40. if (self.tapAction) {
  41. self.tapAction();
  42. }
  43. }
  44. @end