//
//  WithDrawBottomMessageCell.m
//  Open
//
//  Created by 雷俊博 on 2020/10/27.
//  Copyright © 2020 黄江涛 . All rights reserved.
//

#import "WithDrawBottomMessageCell.h"

@implementation WithDrawBottomMessageCell
#pragma mark - life cycle
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
//        [UIColor colorWithHex:0xf4f4f4];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
//        [self.contentView addSubview:self.lb_title];
        [self.contentView addSubview:self.lb_content];
        [self setupUI];
    }
    return self;
}
- (void)setupUI
{
//    [self.lb_title mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.offset(5 * WIDTHRADIU);
//        make.left.offset(20 * WIDTHRADIU);
//        make.height.offset(15 * WIDTHRADIU);
//    }];
    [self.lb_content mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.offset(5 * WIDTHRADIU);
//        make.top.equalTo(self.lb_title.mas_bottom).offset(10 * WIDTHRADIU);
        make.left.offset(20 * WIDTHRADIU);
    }];
}


+ (instancetype)cellWithTableView:(UITableView *)tableView
{
    static NSString *identifier = @"WithDrawBottomMessageCell";
    
    WithDrawBottomMessageCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
    
    if (cell == nil) {
        cell = [[WithDrawBottomMessageCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
    }
    return cell;
}


#pragma getters and setters
- (UILabel *)lb_title
{
    if (!_lb_title) {
        _lb_title = [[UILabel alloc]init];
        _lb_title.textColor = [UIColor colorWithHex:0x808080];
        _lb_title.font = [UIFont systemFontOfSize:15 * WIDTHRADIU];
        _lb_title.text = @"提现说明";
    }
    return _lb_title;
}
- (UILabel *)lb_content
{
    if (!_lb_content) {
        _lb_content = [[UILabel alloc]init];
        NSString *text1 = @"1、由于微信支付要求实名制，非实名用户账号无法支持提现，\n请务必将提现的微信号进行实名认证！\n";
        NSString *text2 = @"2、每日提现总额受微信限制，若当日限额已满，请次日申请。\n";
        NSString *text3 = @"3、每日最多申请提现两次，提现申请将在两个小时内审核到账\n（如遇高峰期，可能延迟到账），请耐心等待。\n";
        
         NSMutableParagraphStyle * paragraphStyle = [[NSMutableParagraphStyle alloc] init];
         [paragraphStyle setLineSpacing:8];
        
        NSMutableAttributedString *attributedString1 = [[NSMutableAttributedString alloc] initWithString:text1 attributes:@{NSParagraphStyleAttributeName: paragraphStyle}];
         NSMutableAttributedString *attributedString2 = [[NSMutableAttributedString alloc] initWithString:text2 attributes:@{NSParagraphStyleAttributeName: paragraphStyle}];
        NSMutableAttributedString *attributedString3 = [[NSMutableAttributedString alloc] initWithString:text3 attributes:@{NSParagraphStyleAttributeName: paragraphStyle}];
        [attributedString1 appendAttributedString:attributedString2];
        [attributedString1 appendAttributedString:attributedString3];
        
         NSRange range = [[[text1 stringByAppendingString:text2] stringByAppendingString:text3] rangeOfString:[[text1 stringByAppendingString:text2] stringByAppendingString:text3]];
        [attributedString1 addAttributes:@{NSForegroundColorAttributeName:[UIColor colorWithHex:0x999999],
                                NSFontAttributeName:[UIFont systemFontOfSize:12 * WIDTHRADIU]} range:range];
        _lb_content.attributedText = attributedString1;
        _lb_content.numberOfLines = 0;
    }
    return _lb_content;
}

- (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
