// // YXMemberItemView.m // Temperature // // Created by TC on 2025/2/16. // #import "YXMemberItemView.h" @implementation YXMemberItemView -(instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { UIImageView *picImgView = [[UIImageView alloc]init]; picImgView.backgroundColor = [UIColor colorWithHexString:@"#F7F7F7"]; picImgView.image = [UIImage imageNamed:@"my_pic"]; [self addSubview:picImgView]; self.picImgView = picImgView; [picImgView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(@0); make.centerX.equalTo(@0); make.height.equalTo(@40); make.width.equalTo(@40); }]; picImgView.layer.cornerRadius = 20; picImgView.layer.masksToBounds = YES; UILabel *markLabel = [[UILabel alloc]init]; markLabel.backgroundColor = [UIColor colorWithHexString:@"#267AFF"]; markLabel.textColor = [UIColor whiteColor]; markLabel.font = [UIFont systemFontOfSize:8]; markLabel.text = @"创建者"; markLabel.textAlignment = NSTextAlignmentCenter; [self addSubview:markLabel]; self.markLabel = markLabel; [markLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(picImgView.mas_bottom).offset(-5); make.centerX.equalTo(@0); make.height.equalTo(@16); make.width.equalTo(@30); }]; markLabel.hidden = YES; markLabel.layer.cornerRadius = 8; markLabel.layer.masksToBounds = YES; UILabel *nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 50, 40, 20)]; nameLabel.textColor = [UIColor colorWithHexString:@"#999999"]; nameLabel.font = [UIFont systemFontOfSize:12]; // nameLabel.text = @"名字"; nameLabel.textAlignment = NSTextAlignmentCenter; [self addSubview:nameLabel]; self.nameLabel = nameLabel; [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(markLabel.mas_bottom).offset(5); make.centerX.equalTo(@0); make.left.equalTo(@0); make.right.equalTo(@0); }]; } return self; } @end