// // KBSearchSpecialView.m // YouHuiProject // // Created by 小花 on 2018/10/22. // Copyright © 2018年 kuxuan. All rights reserved. // #import "KBSearchSpecialView.h" @interface KBSearchSpecialView () @property (nonatomic, strong) UIImageView *imgView; @end @implementation KBSearchSpecialView - (instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { [self addSubview:self.imgView]; [self.imgView mas_makeConstraints:^(MASConstraintMaker *make) { make.edges.mas_equalTo(UIEdgeInsetsMake(0, 0, 0, 0)); }]; } return self; } - (void)setModel:(AdPopModel *)model { _model = model; [self.imgView sd_setImageWithURL:[NSURL URLWithString:model.img]]; } - (void)tapImage { if (self.tapImgBlock) { self.tapImgBlock(self.model); } } - (UIImageView *)imgView { if (!_imgView) { _imgView = [[UIImageView alloc] init]; _imgView.contentMode = UIViewContentModeScaleAspectFill; _imgView.clipsToBounds = YES; _imgView.userInteractionEnabled = YES; _imgView.backgroundColor = [UIColor yhGrayColor]; UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImage)]; [_imgView addGestureRecognizer:tap]; } return _imgView; } @end