No Description

SubmitDefaultIDCardCell.m 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. //
  2. // SubmitDefaultIDCardCell.m
  3. // FirstLink
  4. //
  5. // Created by ascii on 15/12/8.
  6. // Copyright © 2015年 FirstLink. All rights reserved.
  7. //
  8. #import "SubmitDefaultIDCardCell.h"
  9. @interface SubmitDefaultIDCardCell ()
  10. @property (nonatomic, strong) UIImageView *rightArrow;
  11. @end
  12. @implementation SubmitDefaultIDCardCell
  13. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  14. if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
  15. self.selectionStyle = UITableViewCellSelectionStyleNone;
  16. self.bottomColorLine.hidden = YES;
  17. [self addAllSubviews];
  18. }
  19. return self;
  20. }
  21. - (void)addAllSubviews {
  22. [self.contentView addSubview:self.idCardTextLabel];
  23. [self.idCardTextLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  24. make.left.equalTo(self.contentView).offset(15);
  25. make.right.equalTo(self.contentView).offset(-32);
  26. make.centerY.equalTo(self.contentView);
  27. }];
  28. [self.contentView addSubview:self.rightArrow];
  29. [self.rightArrow mas_makeConstraints:^(MASConstraintMaker *make) {
  30. make.right.equalTo(self.contentView).offset(-15);
  31. make.centerY.equalTo(self.contentView);
  32. }];
  33. [self.contentView addSubview:self.bottomColorLine];
  34. [self.bottomColorLine mas_makeConstraints:^(MASConstraintMaker *make) {
  35. make.left.bottom.right.equalTo(self.contentView);
  36. make.height.mas_equalTo(@2);
  37. }];
  38. }
  39. - (void)fk_configWithViewModel:(FKSubmitOrderViewModel *)viewModel indexPath:(NSIndexPath *)indexPath{
  40. if ([viewModel isKindOfClass:[FKSubmitOrderViewModel class]]){
  41. if (viewModel.selectedIdCardItem){
  42. NSString *string = [NSString stringWithFormat:@"身份证信息:%@", viewModel.selectedIdCardItem.idCardNum];
  43. NSMutableAttributedString *attributeString = [[NSMutableAttributedString alloc] initWithString:string];
  44. [attributeString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:NSMakeRange(0, 6)];
  45. [attributeString addAttribute:NSForegroundColorAttributeName value:UIColorFromRGB(0x333333) range:NSMakeRange(0, 6)];
  46. self.idCardTextLabel.attributedText = attributeString;
  47. }
  48. self.bottomColorLine.hidden = NO;
  49. }
  50. }
  51. #pragma mark - Property
  52. - (UILabel *)idCardTextLabel {
  53. if (!_idCardTextLabel) {
  54. _idCardTextLabel = [UILabel new];
  55. _idCardTextLabel.textColor = UIColorFromRGB(0x999999);
  56. _idCardTextLabel.font = [UIFont systemFontOfSize:14];
  57. }
  58. return _idCardTextLabel;
  59. }
  60. - (UIImageView *)rightArrow {
  61. if (!_rightArrow) {
  62. _rightArrow = [UIImageView new];
  63. _rightArrow.image = [UIImage imageNamed:@"Cell_More_Icon"];
  64. }
  65. return _rightArrow;
  66. }
  67. - (UIImageView *)bottomColorLine{
  68. if (_bottomColorLine == nil) {
  69. UIImage *resizeImg = [[UIImage imageNamed:@"submit_colorLine"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 4, 0, 4) resizingMode:UIImageResizingModeTile];
  70. _bottomColorLine = [[UIImageView alloc]initWithImage:resizeImg];
  71. }
  72. return _bottomColorLine;
  73. }
  74. @end