cdts/xdts-ios 3/TreeHole/Code/Chat(消息&聊天)/MessageCell/THGiveVipMessageCell.m
2023-07-27 09:20:00 +08:00

58 lines
2.0 KiB
Objective-C

//
// THGiveVipMessageCell.m
// TreeHole
//
// Created by iOS on 2023/2/9.
// Copyright © 2023 CYH. All rights reserved.
//
#import "THGiveVipMessageCell.h"
@implementation THGiveVipMessageCell
- (void)fillWithData:(THGiveVipMessageCellData *)data {
[super fillWithData:data];
self.vipTitleLb.text = data.vipTypeStr;
}
// 初始化控件
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
self.container.backgroundColor = [UIColor colorWithWhite:1 alpha:0.1];
self.container.layer.cornerRadius = 5;
self.vipIconView = [UIImageView creatViewInSuperView:self.container];
self.vipIconView.image = UIImageMake(@"TH_giveVipMessageIcon");
self.vipTitleLb = [UILabel creatLabelWithFontSize:W_Scale(14) fontWeight:UIFontWeightMedium textColorHex:@"#FFFFFF" inSuperView:self.container];
self.vipSubLb = [UILabel creatLabelWithFontSize:W_Scale(14) fontWeight:UIFontWeightMedium textColorHex:@"#FFFFFF" inSuperView:self.container];
self.vipSubLb.text = @"获得十大专属特权";
}
return self;
}
// 设置控件坐标
- (void)layoutSubviews{
[super layoutSubviews];
CGFloat iconWH = 50;
self.vipIconView.size = CGSizeMake(iconWH, iconWH);
self.vipIconView.qmui_left = 10;
self.vipIconView.qmui_top = self.vipIconView.qmui_topWhenCenterInSuperview;
CGFloat lbW = self.container.qmui_width - self.vipIconView.qmui_right - 15;
[self.vipTitleLb sizeToFit];
self.vipTitleLb.qmui_width = lbW;
self.vipTitleLb.qmui_top = self.vipIconView.qmui_top;
self.vipTitleLb.qmui_left = self.vipIconView.qmui_right + 15;
[self.vipSubLb sizeToFit];
self.vipSubLb.qmui_width = lbW;
self.vipSubLb.qmui_bottom = self.vipIconView.qmui_bottom;
self.vipSubLb.qmui_left = self.vipIconView.qmui_right + 15;
}
@end