// // SubmitDefaultIDCardCell.m // FirstLink // // Created by ascii on 15/12/8. // Copyright © 2015年 FirstLink. All rights reserved. // #import "SubmitDefaultIDCardCell.h" @interface SubmitDefaultIDCardCell () @property (nonatomic, strong) UIImageView *rightArrow; @end @implementation SubmitDefaultIDCardCell - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { self.selectionStyle = UITableViewCellSelectionStyleNone; self.bottomColorLine.hidden = YES; [self addAllSubviews]; } return self; } - (void)addAllSubviews { [self.contentView addSubview:self.idCardTextLabel]; [self.idCardTextLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.contentView).offset(15); make.right.equalTo(self.contentView).offset(-32); make.centerY.equalTo(self.contentView); }]; [self.contentView addSubview:self.rightArrow]; [self.rightArrow mas_makeConstraints:^(MASConstraintMaker *make) { make.right.equalTo(self.contentView).offset(-15); make.centerY.equalTo(self.contentView); }]; [self.contentView addSubview:self.bottomColorLine]; [self.bottomColorLine mas_makeConstraints:^(MASConstraintMaker *make) { make.left.bottom.right.equalTo(self.contentView); make.height.mas_equalTo(@2); }]; } - (void)fk_configWithViewModel:(FKSubmitOrderViewModel *)viewModel indexPath:(NSIndexPath *)indexPath{ if ([viewModel isKindOfClass:[FKSubmitOrderViewModel class]]){ if (viewModel.selectedIdCardItem){ NSString *string = [NSString stringWithFormat:@"身份证信息:%@", viewModel.selectedIdCardItem.idCardNum]; NSMutableAttributedString *attributeString = [[NSMutableAttributedString alloc] initWithString:string]; [attributeString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:NSMakeRange(0, 6)]; [attributeString addAttribute:NSForegroundColorAttributeName value:UIColorFromRGB(0x333333) range:NSMakeRange(0, 6)]; self.idCardTextLabel.attributedText = attributeString; } self.bottomColorLine.hidden = NO; } } #pragma mark - Property - (UILabel *)idCardTextLabel { if (!_idCardTextLabel) { _idCardTextLabel = [UILabel new]; _idCardTextLabel.textColor = UIColorFromRGB(0x999999); _idCardTextLabel.font = [UIFont systemFontOfSize:14]; } return _idCardTextLabel; } - (UIImageView *)rightArrow { if (!_rightArrow) { _rightArrow = [UIImageView new]; _rightArrow.image = [UIImage imageNamed:@"Cell_More_Icon"]; } return _rightArrow; } - (UIImageView *)bottomColorLine{ if (_bottomColorLine == nil) { UIImage *resizeImg = [[UIImage imageNamed:@"submit_colorLine"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 4, 0, 4) resizingMode:UIImageResizingModeTile]; _bottomColorLine = [[UIImageView alloc]initWithImage:resizeImg]; } return _bottomColorLine; } @end