//
//  InsuredMemberAddTableViewCell.m
//  Open
//
//  Created by 雷俊博 on 2019/8/5.
//  Copyright © 2019 黄江涛 . All rights reserved.
//

#import "InsuredMemberAddTableViewCell.h"

#import "Constants.h"

@interface InsuredMemberAddTableViewCell ()





@property (nonatomic, strong)UIView *lineView;

@end
@implementation InsuredMemberAddTableViewCell
#pragma mark - life cycle
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        [self.contentView addSubview:self.lb_title];
        [self.contentView addSubview:self.tf_value];
        [self.contentView addSubview:self.tv_value];
        [self.contentView addSubview:self.lineView];
        [self setupUI];
    }
    return self;
}

- (void)setupUI
{
    [self.lb_title mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(20 * WIDTHRADIU);
        make.top.offset(15 * WIDTHRADIU);
        make.width.offset(65 * WIDTHRADIU);
        make.height.offset(15 * WIDTHRADIU);
    }];
    
    [self.tf_value mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.lb_title.mas_right).offset(25 * WIDTHRADIU);
        make.right.offset(-25 * WIDTHRADIU);
        make.centerY.equalTo(self);
        make.height.offset(40 * WIDTHRADIU);
    }];
    [self.tv_value mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.lb_title.mas_right).offset(25 * WIDTHRADIU);
        make.right.offset(-25 * WIDTHRADIU);
        make.top.offset(7.5 * WIDTHRADIU);
        make.bottom.offset(-7.5 * WIDTHRADIU);
    }];
    [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(10 * WIDTHRADIU);
        make.right.offset(-10 * WIDTHRADIU);
        make.bottom.offset(0);
        make.height.offset(0.5);
    }];
}




#pragma mark - public methods
- (void)refreshUIWithTitle:(NSString *)title
{
    self.lb_title.text = title;
}

#pragma mark - 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];
    }
    return _lb_title;
}

- (UITextField *)tf_value
{
    if (!_tf_value) {
        _tf_value = [[UITextField alloc]init];
        _tf_value.textColor = [UIColor colorWithHex:0x4c4c4c];
        _tf_value.font = [UIFont systemFontOfSize:15 * WIDTHRADIU];
        _tf_value.returnKeyType = UIReturnKeyDone;
        _tf_value.clearButtonMode = UITextFieldViewModeWhileEditing;
    }
    return _tf_value;
}

- (UITextView *)tv_value
{
    if (!_tv_value) {
        _tv_value = [[UITextView alloc]init];
        _tv_value.textColor = [UIColor colorWithHex:0x4c4c4c];
        _tv_value.font = [UIFont systemFontOfSize:15 * WIDTHRADIU];
        _tv_value.hidden = YES;
        _tv_value.scrollEnabled = NO;
       //_tv_value.contentInset = UIEdgeInsetsMake(22.5, 0, 0, 0);
        UILabel *placeHolder = [[UILabel alloc] initWithFrame:CGRectMake(3, 8.5 * WIDTHRADIU, 200, 13* WIDTHRADIU)];
        self.placeHolder = placeHolder;
        
        placeHolder.text = @"请输入户籍地址";
        placeHolder.font = [UIFont systemFontOfSize:15 * WIDTHRADIU];
        placeHolder.textColor = [UIColor colorWithHex:0xc0c0c0];
        placeHolder.numberOfLines = 0;
        placeHolder.contentMode = UIViewContentModeCenter;
        [_tv_value addSubview:placeHolder];
       // _tv_value.textContainerInset = UIEdgeInsetsMake(5, 0, 5, 0);
    }
    return _tv_value;
}

- (UIView *)lineView
{
    if (!_lineView) {
        _lineView = [[UIView alloc]init];
        _lineView.backgroundColor = [UIColor colorWithHex:0xf4f4f4];
    }
    return _lineView;
}

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