123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- //
- // DetailTransitHeaderCell.m
- // FirstLink
- //
- // Created by jack on 15/7/21.
- // Copyright (c) 2015年 FirstLink. All rights reserved.
- //
- #import "DetailTransitHeaderCell.h"
- @implementation DetailTransitHeaderCell
- @synthesize titleLabel = _titleLabel;
- @synthesize bottomLine = _bottomLine;
- - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
- {
- if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
- [self initializeLayout];
- self.selectionStyle = UITableViewCellSelectionStyleNone;
- }
- return self;
- }
- #pragma makr - Function
- - (void)configWithDetailViewModel:(PindanDetailViewModel *)viewModel indexPath:(NSIndexPath *)indexPath{
- kDetailCellType cellType = [viewModel cellTypeForIndexPath:indexPath];
-
- NSString *title = nil;
- if (cellType == kDetailCellTypePriceDetailHeader) title = @"价格说明:";
- if (cellType == kDetailCellTypeTransitHeader) title = @"发货说明:";
- self.titleLabel.text = title;
- }
- #pragma mark - Mark
- - (void)initializeLayout{
-
- [self.contentView addSubview:self.titleLabel];
- [self.contentView addSubview:self.bottomLine];
-
- [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.contentView).offset(15);
- make.centerY.equalTo(self.contentView);
- make.width.equalTo(@79);
- make.height.equalTo(@18);
- }];
-
- [self.bottomLine mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.contentView).offset(15);
- make.right.equalTo(self.contentView).offset(-15);
- make.bottom.equalTo(self.contentView);
- make.height.equalTo(@0.5);
- }];
- }
- #pragma mark - Property
- - (UILabel *)titleLabel
- {
- if (_titleLabel == nil) {
- _titleLabel = [[UILabel alloc]init];
- _titleLabel.backgroundColor = UIColorFromRGB(0x5c5c5c);
- _titleLabel.font = [UIFont systemFontOfSize:13];
- _titleLabel.textColor = [UIColor whiteColor];
- _titleLabel.textAlignment = NSTextAlignmentCenter;
- _titleLabel.text = @"发货说明:";
- }
- return _titleLabel;
- }
- - (UIView *)bottomLine
- {
- if (_bottomLine == nil) {
- _bottomLine = [[UIView alloc]init];
- _bottomLine.backgroundColor = UIColorFromRGB(0xe5e5e5);
- }
- return _bottomLine;
- }
- @end
|