新UI马甲包

HCGotoDetailView.m 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. //
  2. // HCGotoDetailView.m
  3. // hc
  4. //
  5. // Created by hc on 2018/5/29.
  6. // Copyright © 2018年 hc. All rights reserved.
  7. //
  8. #import "HCGotoDetailView.h"
  9. @implementation HCGotoDetailView
  10. - (instancetype)initWithFrame:(CGRect)frame click:(void (^)(void))click{
  11. self = [super initWithFrame:frame];
  12. if (self) {
  13. self.backgroundColor = [UIColor whiteColor];
  14. UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id _Nonnull sender) {
  15. click();
  16. }];
  17. [self addGestureRecognizer:tap];
  18. [self initSubViews];
  19. }
  20. return self;
  21. }
  22. - (void)initSubViews {
  23. UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(15, 0, 200, 20)];
  24. label.textColor = [UIColor homeRedColor];
  25. label.font = [UIFont systemFontOfSize:14];
  26. [self addSubview:label];
  27. label.centerY = self.height/2;
  28. label.text = @"点击查看商品详情";
  29. UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-20-25, 0, 25, 25)];
  30. imgView.centerY = self.height/2;
  31. imgView.image = [UIImage imageNamed:@"goto_detail"];
  32. [self addSubview:imgView];
  33. }
  34. @end