//
//  HWPageListCell.m
//  双子星云手机
//
//  Created by 余衡武 on 2022/3/22.
//

#import "HWPageListCell.h"

@interface HWPageListCell ()

@property (weak, nonatomic) IBOutlet UIImageView *iconImageView;
@property (weak, nonatomic) IBOutlet UILabel     *titleLabel;


@end

@implementation HWPageListCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
    UIImage *defaultImage = [iTools imageFromColor:[UIColor hwColor:@"707070"] view:self.iconImageView];
    self.iconImageView.image = defaultImage;
    
    self.iconImageView.layer.cornerRadius = 10;
    self.iconImageView.layer.masksToBounds = YES;
    self.titleLabel.text = @"biao";
}

- (void)setModel:(BaseModel *)model {
    
    _model = model;
    
    self.titleLabel.text = model.name;
    
    // 相对路径
    NSString *fileName = [model.iconFile lastPathComponent];
    NSString *fileUrl = [kPath_ScreenShot stringByAppendingPathComponent:fileName];
    UIImage *image = [UIImage imageWithContentsOfFile:fileUrl];
    self.iconImageView.image = image;
}

- (IBAction)closeBtnClick:(UIButton *)sender {
    HLog(@"关闭");
    if ([_delegate respondsToSelector:@selector(deleteBtnClickWithModel:)]) {
        [_delegate deleteBtnClickWithModel:self.model];
    }
}

@end
