// // HCGotoDetailView.m // hc // // Created by hc on 2018/5/29. // Copyright © 2018年 hc. All rights reserved. // #import "HCGotoDetailView.h" @implementation HCGotoDetailView - (instancetype)initWithFrame:(CGRect)frame click:(void (^)(void))click{ self = [super initWithFrame:frame]; if (self) { self.backgroundColor = [UIColor whiteColor]; UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id _Nonnull sender) { click(); }]; [self addGestureRecognizer:tap]; [self initSubViews]; } return self; } - (void)initSubViews { UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(15, 0, 200, 20)]; label.textColor = [UIColor homeRedColor]; label.font = [UIFont systemFontOfSize:14]; [self addSubview:label]; label.centerY = self.height/2; label.text = @"点击查看商品详情"; UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-20-25, 0, 25, 25)]; imgView.centerY = self.height/2; imgView.image = [UIImage imageNamed:@"goto_detail"]; [self addSubview:imgView]; } @end