Files
yuyin_ios/SweetParty/主类/TXIM消息/TXHongbaoCell.m

56 lines
2.0 KiB
Mathematica
Raw Normal View History

2025-08-08 11:05:33 +08:00
//
// TXHongbaoCell.m
// romantic
//
// Created by bj_szd on 2022/9/6.
// Copyright © 2022 romantic. All rights reserved.
//
#import "TXHongbaoCell.h"
#import "TUIGlobalization.h"
#import "TUIThemeManager.h"
@implementation TXHongbaoCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
self.bgImgV = [ControlCreator createImageView:nil rect:CGRectZero imageName:@"" backguoundColor:HEXCOLOR(0xFF4745)];
self.bgImgV.layer.cornerRadius = 5;
[self.container addSubview:self.bgImgV];
self.iconImgV = [ControlCreator createImageView:nil rect:CGRectZero imageName:@"msg_hongbao" backguoundColor:nil];
[self.container addSubview:self.iconImgV];
_myTextLabel = [[UILabel alloc] init];
_myTextLabel.numberOfLines = 0;
_myTextLabel.font = [UIFont systemFontOfSize:15 weight:UIFontWeightMedium];
_myTextLabel.textColor = [UIColor whiteColor];
[self.container addSubview:_myTextLabel];
}
return self;
}
- (void)fillWithData:(TXHongbaoCellData *)data;
{
[super fillWithData:data];
self.customData = data;
self.myTextLabel.text = data.text;
}
- (void)layoutSubviews {
[super layoutSubviews];
CGRect rect = [self.myTextLabel.text boundingRectWithSize:CGSizeMake(220-75, MAXFLOAT)
options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading
attributes:@{ NSFontAttributeName : [UIFont systemFontOfSize:15 weight:UIFontWeightMedium] }
context:nil];
self.myTextLabel.frame = CGRectMake(12+50+10, (self.container.size.height-rect.size.height)/2, 220-75, rect.size.height);
self.bgImgV.frame = self.container.bounds;
self.iconImgV.frame = CGRectMake(12, (self.container.size.height-52)/2, 50, 52);
}
@end