1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- //
- // LDSearchSpecialView.m
- // YouHuiProject
- //
- // Created by 小花 on 2018/12/6.
- // Copyright © 2018年 kuxuan. All rights reserved.
- //
- #import "LDSearchSpecialView.h"
- @interface LDSearchSpecialView ()
- @property (nonatomic, strong) UIImageView *imgView;
- @end
- @implementation LDSearchSpecialView
- - (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
|