//
//  ImageCell.m
//  ZLPhotoBrowser
//
//  Created by long on 2017/6/20.
//  Copyright © 2017年 long. All rights reserved.
//

#import "ImageCell.h"

@implementation ImageCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.imageView = [[UIImageView alloc] init];
//        self.imageView.frame = CGRectMake(0, 1, CGRectGetWidth(self.contentView.bounds), CGRectGetHeight(self.contentView.bounds) - 2);
        self.imageView.clipsToBounds = YES;
        self.clipsToBounds = YES;
        [self.contentView addSubview:self.imageView];
        [self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.center.left.equalTo(self.contentView);
            make.top.mas_equalTo(1);
        }];
        self.imageView.contentMode = UIViewContentModeScaleToFill;
        self.playImageView = [[UIImageView alloc] initWithFrame:CGRectMake(self.bounds.size.width/2-15, self.bounds.size.height/2-15, 30, 30)];
        self.playImageView.image = [UIImage imageNamed:@"zl_playVideo"];
        [self.contentView addSubview:self.playImageView];
        
        
        self.delButton = [UIButton buttonWithType:UIButtonTypeCustom];
        self.delButton.frame = CGRectMake(CGRectGetWidth(self.frame) - 25 , 0, 25, 25);
        [self.delButton addTarget:self action:@selector(delBtnClcik) forControlEvents:UIControlEventTouchUpInside];
        [self.contentView addSubview:self.delButton];
        [self.delButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.contentView);
            make.right.equalTo(self.contentView.mas_right).offset(0);
            make.width.height.mas_equalTo(25);
        }];
    }
    return self;
}
- (void)delBtnClcik{
    if (self.delBtnClick) {
        self.delBtnClick();
    }
}

@end
