// // RDSHomeTopView.m // Temperature // // Created by RD on 2022/10/25. // #import "RDSHomeTopView.h" #import "NSDate+currentDate.h" @interface RDSHomeTopView () @property (weak, nonatomic) IBOutlet UILabel *titleLab; @property (weak, nonatomic) IBOutlet UILabel *welcomeMessageLabel; @property (weak, nonatomic) IBOutlet UILabel *timeLab; @property (weak, nonatomic) IBOutlet UILabel *tempLab;// 温度 @property (weak, nonatomic) IBOutlet UILabel *weateherTextLab; @property (weak, nonatomic) IBOutlet UILabel *cityLab;// 城市 @property (weak, nonatomic) IBOutlet UILabel *rhLab;// 湿度 @property (weak, nonatomic) IBOutlet UIImageView *imgView; @end @implementation RDSHomeTopView - (void)awakeFromNib { [super awakeFromNib]; // Initialization code _timeLab.text = [NSDate rds_getDayString]; } - (void)setTitle:(NSString *)title{ _title = title; _titleLab.text = title; } - (void)setModel:(WeatherModel *)model{ _model = model; _tempLab.text = [NSString stringWithFormat:@"%d", model.now.temp]; _weateherTextLab.text = model.now.text; _cityLab.text = model.location.city; _rhLab.text = [NSString stringWithFormat:@"%d%%", model.now.rh]; _imgView.image = [UIImage imageNamed:[NSString stringWithFormat:@"icon_weather_%@", model.now.icon_code]]; } - (void)setSystemParameter:(RDSSystemParameterModel *)systemParameter { _systemParameter = systemParameter; self.welcomeMessageLabel.text = systemParameter.nameValue; } - (IBAction)onHeadClickAction:(id)sender { BLOCK_SAFE_RUN(_onHeadClick) } @end