//
//  RDSCtrlModeCell.m
//  Temperature
//
//  Created by RD on 2023/1/6.
//

#import "RDSCtrlModeCell.h"
#import "UIImage+Extension.h"

@interface RDSCtrlModeCell ()
@property (weak, nonatomic) IBOutlet UIButton *btn;

@end
@implementation RDSCtrlModeCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setMode:(int)mode{
    _mode = mode;
    if(mode == self.tag){
        _btn.selected = YES;
    }else{
        _btn.selected = NO;
    }
}

- (void)setModelImg:(ModelImg *)modelImg{
    _modelImg = modelImg;
    [_btn setImage:[UIImage imageNamed:modelImg.img] forState:UIControlStateNormal];
    [_btn setImage:[UIImage imageNamed:modelImg.imgSel] forState:UIControlStateSelected];
    
    // 设置背景颜色
    UIImage *lightGreenImg = [UIImage rds_imageWithColor:RDSLightGreenColor];
    UIImage *greenImg = [UIImage rds_imageWithColor:RDSGreenColor];
    [_btn setBackgroundImage:lightGreenImg forState:UIControlStateNormal];
    [_btn setBackgroundImage:greenImg forState:UIControlStateSelected];
    
}

- (IBAction)p_modeBtnClick:(UIButton *)sender {
    
    sender.selected = !sender.isSelected;
    
}


@end



