// // YXDeviceCollectionViewCell.m // Temperature // // Created by z on 2025/1/17. // #import "YXDeviceCollectionViewCell.h" @implementation YXDeviceCollectionViewCell - (instancetype)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { self.picImgView = [[UIImageView alloc] init]; self.picImgView.contentMode = UIViewContentModeScaleAspectFit; [self.contentView addSubview:self.picImgView]; [self.picImgView mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.equalTo(self.mas_centerX); make.top.equalTo(@20); make.width.equalTo(self.contentView.mas_width).multipliedBy(0.5); make.height.equalTo(self.picImgView.mas_width); }]; self.textLabel = [[UILabel alloc] init]; self.textLabel.font = [UIFont systemFontOfSize:13]; self.textLabel.textAlignment = NSTextAlignmentCenter; self.textLabel.numberOfLines = 2; [self.contentView addSubview:self.textLabel]; [self.textLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.picImgView.mas_bottom); make.left.equalTo(@10); make.right.equalTo(@-10); make.bottom.equalTo(@0); }]; } return self; } @end