cdts/xdts-ios 3/Pods/TUIChat/MyVIPCardsCell.m
2023-07-27 09:20:00 +08:00

68 lines
2.5 KiB
Objective-C

//
// MyVIPCardCell.m
// TreeHole
//
// Created by 末班车 on 2022/11/29.
//
#import "MyVIPCardsCell.h"
@implementation MyVIPCardsCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
_icon = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"vipLogo"]];
// _icon.backgroundColor = [UIColor redColor];
[self.container addSubview:_icon];
_myTextLabel = [[UILabel alloc] init];
_myTextLabel.numberOfLines = 0;
_myTextLabel.font = [UIFont systemFontOfSize:14];
_myTextLabel.text = @"赠送你一个月会员";
_myTextLabel.textColor = [UIColor whiteColor];
[self.container addSubview:_myTextLabel];
_myLinkLabel = [[UILabel alloc] initWithFrame:CGRectZero];
_myLinkLabel.text = @"获得十大专属特权";
_myLinkLabel.font = [UIFont systemFontOfSize:14];
_myLinkLabel.textColor = [UIColor whiteColor];
[self.container addSubview:_myLinkLabel];
self.container.backgroundColor = [UIColor colorWithRed:45/255.0 green:47/255.0 blue:66/255.0 alpha:1];
[self.container.layer setMasksToBounds:YES];
[self.container.layer setBorderColor:[UIColor lightGrayColor].CGColor];
[self.container.layer setBorderWidth:1];
[self.container.layer setCornerRadius:5];
}
return self;
}
- (void)fillWithData:(MyVipCarDatas *)data
{
[super fillWithData:data];
self.customData = data;
self.myTextLabel.text = data.text;
}
- (void)layoutSubviews
{
[super layoutSubviews];
// CGRect rect = [self.myTextLabel.text boundingRectWithSize:CGSizeMake(245, MAXFLOAT)
// options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading
// attributes:@{ NSFontAttributeName : [UIFont systemFontOfSize:15] }
// context:nil];
// self.myTextLabel.mm_top(10).mm_left(10).mm_width(245).mm_height(rect.size.height);
// self.myLinkLabel.mm_sizeToFit().mm_left(10).mm_top(self.myTextLabel.mm_y + self.myTextLabel.mm_h +15);
_icon.mm_left(14).mm_top(15).mm_height(50).mm_width(50);
_myTextLabel.mm_left(self.icon.mm_maxX+15).mm_top(15).mm_width(200).mm_height(20);
_myLinkLabel.mm_left(self.icon.mm_maxX+15).mm_top(self.myTextLabel.mm_maxY+10).mm_height(20).mm_width(256);
}
@end