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.
 
 
 
 

123 lines
4.1 KiB

//
// LineStatusTableViewCell.m
// tongxin
//
// Created by ecell on 2023/6/1.
// Copyright © 2023 xTT. All rights reserved.
//
#import "LineStatusTableViewCell.h"
@interface LineStatusTableViewCell ()
@property (nonatomic ,strong) UIImageView *iconImg;
@property (nonatomic ,weak) UILabel *titleLabel;
@property (nonatomic ,weak) UILabel *textsLabel;
@end
@implementation LineStatusTableViewCell
- (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)cellWithImg:(NSString *)img Title:(NSString *)title Texts:(NSString *)texts
{
self.iconImg.image = ImageName_(img);
self.titleLabel.text = title;
self.textsLabel.attributedText = [self labelTextFontSize:texts];
}
- (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:@""];
self.iconImg = iconImg;
[bgView addSubview:iconImg];
[iconImg mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(bgView.mas_left).offset(15);
make.top.equalTo(bgView.mas_top).offset(20);
make.size.mas_equalTo(CGSizeMake(22, 22));
}];
/// 号码
UILabel *titleLabel = [UICommon ui_label:CGRectZero lines:1 align:NSTextAlignmentLeft font:FontBold_(18) textColor:mainColor text:@"" Radius:0];
self.titleLabel = titleLabel;
[bgView addSubview:titleLabel];
[titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(iconImg.mas_right).offset(8);
make.centerY.equalTo(iconImg.mas_centerY);
}];
/// 内容
UILabel *textsLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentLeft font:Font_(14) textColor:KKBlack20 text:@"" Radius:0];
[UICommon labelFontSize:@""];
textsLabel.lineBreakMode = NSLineBreakByTruncatingHead;
self.textsLabel = textsLabel;
[bgView addSubview:textsLabel];
[textsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(bgView.mas_right).inset(15);
make.left.equalTo(iconImg.mas_right);
make.top.equalTo(titleLabel.mas_bottom).offset(15);
make.bottom.equalTo(bgView.mas_bottom).inset(20);
}];
}
- (NSAttributedString *)labelTextFontSize:(NSString *)text
{
NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:text];
NSString *temp = nil;
for(int i = 0; i < [text length]; i++)
{
temp = [text substringWithRange:NSMakeRange(i,1)];
if ([temp isEqualToString:@""]) {
NSRange range = NSMakeRange(i, 1);
[string addAttribute:NSForegroundColorAttributeName value:RGB(255, 175, 147) range:range];
[string addAttribute:NSFontAttributeName value:Font_(20) range:range];
}
}
NSMutableParagraphStyle *paragraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
paragraphStyle.headIndent = 10;
paragraphStyle.lineSpacing = 5;
paragraphStyle.alignment = NSTextAlignmentLeft;
[string addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, string.length)];
return string;
}
- (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