123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- //
- // LogisticsCell.m
- // FirstLink
- //
- // Created by ascii on 15/5/29.
- // Copyright (c) 2015年 FirstLink. All rights reserved.
- //
- #import "LogisticsProgressCell.h"
- @implementation LogisticsProgressCell
- - (void)awakeFromNib {
- // Initialization code
- [super awakeFromNib];
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
- // Configure the view for the selected state
- }
- - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
- self = [super initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:reuseIdentifier];
- if (self) {
- [self addSubviewsForStyleProgress];
- }
- return self;
- }
- - (void)addSubviewsForStyleProgress {
- [self addCommonSubviews];
-
- WeakSelf(weakSelf);
- UIView *line = [self makeNewLine];
- [self.contentView addSubview:line];
- [line mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(weakSelf.contentView).with.offset(26);
- make.top.equalTo(weakSelf.contentView).with.offset(0);
- make.bottom.equalTo(weakSelf.contentView).with.offset(0);
- make.width.mas_equalTo(1.0/[UIScreen mainScreen].scale);
- }];
-
- UIImageView *circle = [self makeCircle];
- [circle setImage:[UIImage imageNamed:@"LogisticsUnreceivedIcon"]];
- [self.contentView addSubview:circle];
- [circle mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.equalTo(line.mas_centerX);
- make.top.equalTo(weakSelf.contentView).with.offset(15);
- make.size.mas_equalTo(CGSizeMake(12, 12));
- }];
- }
- - (void)addCommonSubviews {
- WeakSelf(weakSelf);
- [self.contentView addSubview:self.logisticsTimeLabel];
- [self.logisticsTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(weakSelf.contentView).with.offset(47);
- make.right.equalTo(weakSelf.contentView).with.offset(-15);
- make.bottom.equalTo(weakSelf.contentView).with.offset(-12);
- make.height.mas_equalTo(20);
- }];
-
- [self.contentView addSubview:self.logisticsTextLabel];
- [self.logisticsTextLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(weakSelf.contentView).with.offset(47);
- make.right.equalTo(weakSelf.contentView).with.offset(-15);
- make.top.equalTo(weakSelf.contentView).with.offset(15);
- make.bottom.equalTo(weakSelf.logisticsTimeLabel.mas_top).with.offset(-6);
- }];
-
- [self.contentView addSubview:self.horizontalLine];
- [self.horizontalLine mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(weakSelf.contentView).with.offset(47);
- make.right.equalTo(weakSelf.contentView).with.offset(-15);
- make.top.equalTo(weakSelf.contentView);
- make.height.mas_equalTo(1.0/[UIScreen mainScreen].scale);
- }];
- }
- #pragma mark - Property
- - (UILabel *)logisticsTextLabel {
- if (!_logisticsTextLabel) {
- _logisticsTextLabel = [[UILabel alloc] init];
- _logisticsTextLabel.textColor = UIColorFromRGB(0x7a7a7a);
- _logisticsTextLabel.font = [UIFont systemFontOfSize:14];
- _logisticsTextLabel.numberOfLines = 0;
- _logisticsTextLabel.lineBreakMode = NSLineBreakByWordWrapping;
- }
- return _logisticsTextLabel;
- }
- - (UILabel *)logisticsTimeLabel {
- if (!_logisticsTimeLabel) {
- _logisticsTimeLabel = [[UILabel alloc] init];
- _logisticsTimeLabel.textColor = UIColorFromRGB(0x7a7a7a);
- _logisticsTimeLabel.font = [UIFont systemFontOfSize:13.0];
- // _logisticsTimeLabel.backgroundColor = [UIColor redColor];
- }
- return _logisticsTimeLabel;
- }
- - (UIView*)makeNewLine {
- UIView *view = [[UIView alloc] init];
- view.backgroundColor = UIColorFromRGB(0xe5e5e5);
- return view;
- }
- - (UIView *)horizontalLine {
- if (!_horizontalLine) {
- _horizontalLine = [self makeNewLine];
- }
- return _horizontalLine;
- }
- - (UIImageView*)makeCircle {
- UIImageView *circle = [[UIImageView alloc] init];
-
- return circle;
- }
- #pragma mark -
- + (CGFloat)titleHeightWith:(NSString *)title {
- return [FLStringHelper rectOfString:title
- font:[UIFont systemFontOfSize:14]
- width:(UISCREENWIDTH - 47 - 15)].size.height;
- }
- + (CGFloat)cellHeightWith:(NSString *)title {
- CGFloat otherHeight = (15 + 6 + 20 + 12 + 1);
- CGFloat titleHeight = [LogisticsProgressCell titleHeightWith:title];
-
- return (otherHeight + titleHeight);
- }
- @end
|