123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- //
- // DRMineAdView.m
- // YouHuiProject
- //
- // Created by 小花 on 2018/6/6.
- // Copyright © 2018年 kuxuan. All rights reserved.
- //
- #import "DRMineAdView.h"
- @interface DRMineAdView ()
- {
- UIImageView *_imageView;
- }
- @end
- @implementation DRMineAdView
- - (instancetype)initWithFrame:(CGRect)frame {
- self = [super initWithFrame:frame];
- if (self) {
- self.backgroundColor = [UIColor clearColor];
-
- self.clipsToBounds = YES;
- [self initSubViews];
- UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAction)];
- [self addGestureRecognizer:tap];
- }
- return self;
- }
- - (void)initSubViews {
-
-
- _imageView = [[UIImageView alloc] init];
- _imageView.userInteractionEnabled = YES;
- _imageView.clipsToBounds = YES;
- _imageView.layer.masksToBounds = YES;
- _imageView.contentMode = UIViewContentModeScaleAspectFill;
- _imageView.backgroundColor = [UIColor whiteColor];
- _imageView.layer.cornerRadius = 6;
- [self addSubview:_imageView];
- [_imageView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.right.top.mas_equalTo(0);
- make.bottom.mas_equalTo(-5);
- }];
- }
- - (void)setModel:(AdPopModel *)model {
- _model = model;
- [_imageView sd_setImageWithURL:[NSURL URLWithString:model.img] placeholderImage:nil];
- }
- - (void)tapAction {
- if (self.tapAdBlock) {
- self.tapAdBlock(_model);
- }
- }
- - (void)closeAction {
- if (self.closeBlock) {
- self.closeBlock();
- }
- }
- @end
|