// // YXMenuItemView.m // Temperature // // Created by z on 2025/1/16. // #import "YXMenuItemView.h" @implementation YXMenuItemView - (instancetype)init { self = [super init]; if (self) { [self setItemSubViews]; } return self; } -(void)setItemSubViews { UILabel *textLabel = [[UILabel alloc]init]; textLabel.font = [UIFont systemFontOfSize:15 weight:UIFontWeightMedium]; textLabel.textAlignment = NSTextAlignmentCenter; textLabel.textColor = [UIColor colorWithHexString:@"#333333"]; [self addSubview:textLabel]; [textLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(@0); make.left.equalTo(@0); make.right.equalTo(@0); make.bottom.equalTo(@0); }]; self.textLabel = textLabel; UIView *colorView = [[UIView alloc]init]; colorView.backgroundColor = [UIColor colorWithHexString:@"#267AFF" alpha:0.2]; [self addSubview:colorView]; [colorView mas_makeConstraints:^(MASConstraintMaker *make) { make.height.equalTo(@6); make.width.equalTo(@60); make.centerX.equalTo(@0); make.centerY.equalTo(@6); }]; colorView.hidden = YES; self.colorView = colorView; } /* // Only override drawRect: if you perform custom drawing. // An empty implementation adversely affects performance during animation. - (void)drawRect:(CGRect)rect { // Drawing code } */ @end