Bez popisu

DetailTransitHeaderCell.m 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. //
  2. // DetailTransitHeaderCell.m
  3. // FirstLink
  4. //
  5. // Created by jack on 15/7/21.
  6. // Copyright (c) 2015年 FirstLink. All rights reserved.
  7. //
  8. #import "DetailTransitHeaderCell.h"
  9. @implementation DetailTransitHeaderCell
  10. @synthesize titleLabel = _titleLabel;
  11. @synthesize bottomLine = _bottomLine;
  12. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
  13. {
  14. if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
  15. [self initializeLayout];
  16. self.selectionStyle = UITableViewCellSelectionStyleNone;
  17. }
  18. return self;
  19. }
  20. #pragma makr - Function
  21. - (void)configWithDetailViewModel:(PindanDetailViewModel *)viewModel indexPath:(NSIndexPath *)indexPath{
  22. kDetailCellType cellType = [viewModel cellTypeForIndexPath:indexPath];
  23. NSString *title = nil;
  24. if (cellType == kDetailCellTypePriceDetailHeader) title = @"价格说明:";
  25. if (cellType == kDetailCellTypeTransitHeader) title = @"发货说明:";
  26. self.titleLabel.text = title;
  27. }
  28. #pragma mark - Mark
  29. - (void)initializeLayout{
  30. [self.contentView addSubview:self.titleLabel];
  31. [self.contentView addSubview:self.bottomLine];
  32. [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  33. make.left.equalTo(self.contentView).offset(15);
  34. make.centerY.equalTo(self.contentView);
  35. make.width.equalTo(@79);
  36. make.height.equalTo(@18);
  37. }];
  38. [self.bottomLine mas_makeConstraints:^(MASConstraintMaker *make) {
  39. make.left.equalTo(self.contentView).offset(15);
  40. make.right.equalTo(self.contentView).offset(-15);
  41. make.bottom.equalTo(self.contentView);
  42. make.height.equalTo(@0.5);
  43. }];
  44. }
  45. #pragma mark - Property
  46. - (UILabel *)titleLabel
  47. {
  48. if (_titleLabel == nil) {
  49. _titleLabel = [[UILabel alloc]init];
  50. _titleLabel.backgroundColor = UIColorFromRGB(0x5c5c5c);
  51. _titleLabel.font = [UIFont systemFontOfSize:13];
  52. _titleLabel.textColor = [UIColor whiteColor];
  53. _titleLabel.textAlignment = NSTextAlignmentCenter;
  54. _titleLabel.text = @"发货说明:";
  55. }
  56. return _titleLabel;
  57. }
  58. - (UIView *)bottomLine
  59. {
  60. if (_bottomLine == nil) {
  61. _bottomLine = [[UIView alloc]init];
  62. _bottomLine.backgroundColor = UIColorFromRGB(0xe5e5e5);
  63. }
  64. return _bottomLine;
  65. }
  66. @end