You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

117 lines
3.9 KiB

//
// ShortMessageListTableViewCell.m
// tongxin
//
// Created by ecell on 2023/5/30.
// Copyright © 2023 xTT. All rights reserved.
//
#import "ShortMessageListTableViewCell.h"
@interface ShortMessageListTableViewCell ()
@property (nonatomic ,weak) UILabel *numberLabel;
@property (nonatomic ,weak) UILabel *timeLabel;
@property (nonatomic ,weak) UILabel *textsLabel;
@end
@implementation ShortMessageListTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self)
{
self.selectionStyle = UITableViewCellSelectionStyleNone;
self.backgroundColor = KKClearColor;
[self subCellView];
}
return self;
}
- (void)setSmsModel:(SmSModel *)smsModel
{
_smsModel = smsModel;
self.numberLabel.text = smsModel.phone;
self.timeLabel.text = [UICommon updateTimeForRow:[NSString stringWithFormat:@"%@",smsModel.timestamp]];
self.textsLabel.text = smsModel.content;
}
- (void)subCellView
{
UIView *bgView = [UICommon ui_view:CGRectZero backgroundColor:KKWhiteColorColor cornerRadius:10 borderWidth:0 borderColor:KKWhiteColorColor];
[self.contentView addSubview:bgView];
[bgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView.mas_left).offset(15);
make.right.equalTo(self.contentView.mas_right).inset(15);
make.top.equalTo(self.contentView.mas_top).offset(8);
make.bottom.equalTo(self.contentView.mas_bottom).inset(7);
}];
UIImageView *iconImg = [UICommon ui_imageView:CGRectZero fileName:@"shortMessage_icon"];
[bgView addSubview:iconImg];
[iconImg mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(bgView.mas_left).offset(10);
make.top.equalTo(bgView.mas_top).offset(29);
make.size.mas_equalTo(iconImg.image.size);
}];
/// 号码
UILabel *numberLabel = [UICommon ui_label:CGRectZero lines:1 align:NSTextAlignmentLeft font:FontADA_(16) textColor:RGB(51, 51, 51) text:@"" Radius:0];
self.numberLabel = numberLabel;
[bgView addSubview:numberLabel];
[numberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(iconImg.mas_right).offset(10);
make.top.equalTo(bgView.mas_top).offset(13);
}];
/// 右箭头
UIImageView *rightImg = [UICommon ui_imageView:CGRectZero fileName:@"icon_enter_gray"];
[bgView addSubview:rightImg];
[rightImg mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(numberLabel.mas_centerY);
make.right.equalTo(bgView.mas_right).inset(15);
make.size.mas_equalTo(rightImg.image.size);
}];
/// 时间
UILabel *timeLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentLeft font:Font_(12) textColor:KKGrey163 text:@"" Radius:0];
self.timeLabel = timeLabel;
[bgView addSubview:timeLabel];
[timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(rightImg.mas_left).inset(5);
make.centerY.equalTo(numberLabel.mas_centerY);
}];
/// 内容
UILabel *textsLabel = [UICommon ui_label:CGRectZero lines:2 align:NSTextAlignmentLeft font:Font_(14) textColor:KKGrey102 text:@"" Radius:0];
self.textsLabel = textsLabel;
[bgView addSubview:textsLabel];
[textsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(bgView.mas_right).inset(15);
make.left.equalTo(numberLabel.mas_left);
make.top.equalTo(numberLabel.mas_bottom).offset(10);
make.bottom.equalTo(bgView.mas_bottom).inset(15);
}];
}
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end