123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- //
- // 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
|