123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- //
- // YXItemView.m
- // Temperature
- //
- // Created by z on 2025/1/15.
- //
- #import "YXItemView.h"
- @implementation YXItemView
- - (instancetype)init
- {
- self = [super init];
- if (self) {
- self.backgroundColor = UIColor.whiteColor;
- [self setItemSubViews];
- }
- return self;
- }
- -(void)setItemSubViews
- {
- UIImageView *picView = [[UIImageView alloc]init];
- [self addSubview:picView];
- [picView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.equalTo(self.mas_centerY);
- make.left.equalTo(@10);
- make.width.equalTo(@20);
- make.height.equalTo(@20);
- }];
- self.picImgView = picView;
-
- UIView *colorView = [[UIView alloc]init];
- colorView.backgroundColor = [UIColor colorWithHexString:@"#48E441"];
- [self addSubview:colorView];
- [colorView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.equalTo(self.mas_centerY);
- make.right.equalTo(@-10);
- make.width.equalTo(@6);
- make.height.equalTo(@6);
- }];
- self.colorView = colorView;
- colorView.layer.cornerRadius = 3;
-
- UILabel *textLabel = [[UILabel alloc]init];
- textLabel.font = [UIFont systemFontOfSize:14];
- textLabel.textAlignment = NSTextAlignmentCenter;
- textLabel.textColor = [UIColor colorWithHexString:@"#333333"];
- [self addSubview:textLabel];
- [textLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.equalTo(self.mas_centerY);
- make.left.equalTo(picView.mas_right).offset(5);
- make.right.equalTo(colorView.mas_right).offset(-5);
- make.height.equalTo(@30);
- }];
- self.textLabel = textLabel;
-
-
-
- }
- /*
- // Only override drawRect: if you perform custom drawing.
- // An empty implementation adversely affects performance during animation.
- - (void)drawRect:(CGRect)rect {
- // Drawing code
- }
- */
- @end
|