//
//  NvEditBottomCollectionViewCell.m
//  SDKDemo
//
//  Created by ms20180425 on 2018/6/12.
 //
//

#import "NvEditBottomCollectionViewCell.h"
#import "NVHeader.h"

@interface NvEditBottomCollectionViewCell ()

@property (nonatomic, strong) UIImageView *iconView;

@property (nonatomic, strong) UILabel *titleLabel;

@end

@implementation NvEditBottomCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self addSubViews];
    }
    return self;
}

- (void)addSubViews{
    
    self.iconView = [[UIImageView alloc]init];
    
    self.titleLabel = [[UILabel alloc]init];
    self.titleLabel.alpha = 0.8;
    self.titleLabel.textColor = UIColor.whiteColor;
    self.titleLabel.font = [NvUtils fontWithSize:12 * SCREANSCALE];
    
    [self addSubview:self.iconView];
    [self addSubview:self.titleLabel];
    
    [self.iconView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.mas_centerX);
        make.top.equalTo(self.mas_top);
        make.width.offset(45 * SCREANSCALE);
        make.height.offset(45 * SCREANSCALE);
    }];
    
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.mas_centerX);
        make.top.equalTo(self.iconView.mas_bottom).offset(12 * SCREANSCALE);
    }];
}

- (void)setDict:(NSDictionary *)dict{
    _dict = dict;
    self.titleLabel.text = [dict allKeys].lastObject;
    self.iconView.image = [NvUtils imageWithName:[dict allValues].lastObject];
    self.iconView.contentMode = UIViewContentModeScaleAspectFit;
}


@end
