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.
		
		
		
		
		
			
		
			
				
					
					
						
							114 lines
						
					
					
						
							3.6 KiB
						
					
					
				
			
		
		
	
	
							114 lines
						
					
					
						
							3.6 KiB
						
					
					
				// | 
						|
//  TFMineTableViewCell.m | 
						|
//  TFReader | 
						|
// | 
						|
//  Created by 谢腾飞 on 2020/12/11. | 
						|
//  Copyright © 2020 xtfei_2011@126.com. All rights reserved. | 
						|
// | 
						|
 | 
						|
#import "TFMineTableViewCell.h" | 
						|
#import "TFUserCenterModel.h" | 
						|
 | 
						|
@interface TFMineTableViewCell () | 
						|
 | 
						|
@property (nonatomic ,strong) UIImageView *iconView; | 
						|
@property (nonatomic ,strong) UILabel *titleLabel; | 
						|
@property (nonatomic ,strong) UILabel *subtitleLabel; | 
						|
@property (nonatomic ,strong) UIImageView *connerView; | 
						|
 | 
						|
@end | 
						|
 | 
						|
@implementation TFMineTableViewCell | 
						|
 | 
						|
- (void)createSubviews | 
						|
{ | 
						|
    [super createSubviews]; | 
						|
     | 
						|
    [self setupSubview]; | 
						|
    [self setupSubviewFrame]; | 
						|
} | 
						|
 | 
						|
- (void)setupSubview | 
						|
{ | 
						|
    self.iconView = [[UIImageView alloc] init]; | 
						|
    self.iconView.image = HoldImage; | 
						|
    [self.contentView addSubview:self.iconView]; | 
						|
     | 
						|
     | 
						|
    self.titleLabel = [[UILabel alloc] init]; | 
						|
    self.titleLabel.backgroundColor = kWhiteColor; | 
						|
    self.titleLabel.textAlignment = NSTextAlignmentLeft; | 
						|
    self.titleLabel.textColor = kBlackColor; | 
						|
    self.titleLabel.font = kMainFont; | 
						|
    [self.contentView addSubview:self.titleLabel]; | 
						|
     | 
						|
     | 
						|
    self.connerView = [[UIImageView alloc] init]; | 
						|
    self.connerView.image = [UIImage imageNamed:@"public_more"]; | 
						|
    [self.contentView addSubview:self.connerView]; | 
						|
     | 
						|
     | 
						|
    self.subtitleLabel = [[UILabel alloc] init]; | 
						|
    self.subtitleLabel.numberOfLines = 2; | 
						|
    self.subtitleLabel.textAlignment = NSTextAlignmentRight; | 
						|
    self.subtitleLabel.textColor = kGrayTextColor; | 
						|
    self.subtitleLabel.backgroundColor = kWhiteColor; | 
						|
    self.subtitleLabel.font = kFont12; | 
						|
    [self.contentView addSubview:self.subtitleLabel]; | 
						|
} | 
						|
 | 
						|
- (void)setupSubviewFrame | 
						|
{ | 
						|
    [self.iconView mas_makeConstraints:^(MASConstraintMaker *make) { | 
						|
        make.left.mas_equalTo(kHalfMargin + kQuarterMargin); | 
						|
        make.centerY.mas_equalTo(self.contentView.mas_centerY); | 
						|
        make.width.height.mas_equalTo(20); | 
						|
    }]; | 
						|
     | 
						|
     | 
						|
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { | 
						|
        make.left.mas_equalTo(self.iconView.mas_right).with.offset(kHalfMargin + kQuarterMargin); | 
						|
        make.centerY.mas_equalTo(self.contentView.mas_centerY); | 
						|
        make.width.mas_equalTo(120); | 
						|
        make.height.mas_equalTo(kLabelHeight); | 
						|
    }]; | 
						|
     | 
						|
     | 
						|
    [self.connerView mas_makeConstraints:^(MASConstraintMaker *make) { | 
						|
        make.right.mas_equalTo(self.contentView.mas_right).with.offset(- kMargin); | 
						|
        make.centerY.mas_equalTo(self.contentView.mas_centerY); | 
						|
        make.width.height.mas_equalTo(10); | 
						|
    }]; | 
						|
     | 
						|
     | 
						|
    [self.subtitleLabel mas_makeConstraints:^(MASConstraintMaker *make) { | 
						|
        make.right.mas_equalTo(self.connerView.mas_left).with.offset(- kQuarterMargin); | 
						|
        make.centerY.mas_equalTo(self.contentView.mas_centerY); | 
						|
        make.left.equalTo(self.titleLabel.mas_right).offset(kQuarterMargin); | 
						|
    }]; | 
						|
} | 
						|
 | 
						|
- (void)setCellModel:(TFUserCenterListModel *)cellModel | 
						|
{ | 
						|
    if (_cellModel != cellModel) { | 
						|
        _cellModel = cellModel; | 
						|
         | 
						|
        self.titleLabel.text = cellModel.title ? : @""; | 
						|
         | 
						|
        [self.titleLabel mas_updateConstraints:^(MASConstraintMaker *make) { | 
						|
            make.width.mas_equalTo([TFViewHelper getDynamicWidthWithLabel:self.titleLabel]); | 
						|
        }]; | 
						|
         | 
						|
        self.subtitleLabel.text = cellModel.desc ? : @""; | 
						|
         | 
						|
        self.titleLabel.textColor = [UIColor colorWithHexString:cellModel.title_color ? : @""]; | 
						|
         | 
						|
        self.subtitleLabel.textColor = [UIColor colorWithHexString:cellModel.desc_color ? : @""]; | 
						|
         | 
						|
        [self.iconView setImageWithURL:[NSURL URLWithString:cellModel.icon ? : @""] placeholder:HoldImage options:YYWebImageOptionSetImageWithFadeAnimation completion:nil]; | 
						|
 | 
						|
        self.connerView.hidden = !cellModel.enable; | 
						|
    } | 
						|
} | 
						|
 | 
						|
@end
 | 
						|
 |