TransportPurductCell.m 3.31 KB
Newer Older
陈俊俊's avatar
陈俊俊 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
//
//  TransportPurductCell.m
//  XFFruit
//
//  Created by 陈俊俊 on 15/9/6.
//  Copyright (c) 2015年 Xummer. All rights reserved.
//

#import "TransportPurductCell.h"
#define LeftMargin 13
#define TableHeight 44
#define SmallSize 10
#define SmallWidth 20
#define SpaceMargin 1
#define LeftWidth 40

#define ShowWidth 150
#define ShowHeight 20

@implementation TransportPurductCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self =  [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self bulidLayout];
    }
    return self;
}

- (void)bulidLayout
{
    CGFloat headWidth = (ScreenSize.width - LeftWidth*2 - SpaceMargin* (4 -1))/4;
    
    
    self.seqLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, 0, SmallWidth, TableHeight))];
    self.seqLabel.textColor = GXF_CONTENT_COLOR;
    self.seqLabel.text = @"13";
    self.seqLabel.font = GXF_SIXTEENTEH_SIZE;
    
    self.titleLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftWidth, 0, headWidth, TableHeight))];
    self.titleLabel.textAlignment = NSTextAlignmentLeft;
    self.titleLabel.textColor = GXF_CONTENT_COLOR;
    self.titleLabel.text = @"苹果桃子";
    self.titleLabel.font = GXF_SIXTEENTEH_SIZE;
    
    self.standLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.titleLabel.frame) + SpaceMargin, 0, headWidth, TableHeight))];
    self.standLabel.textAlignment = NSTextAlignmentLeft;
    self.standLabel.textColor = GXF_CONTENT_COLOR;
    self.standLabel.text = @"80";
    self.standLabel.font = GXF_SIXTEENTEH_SIZE;
    
    self.countLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.standLabel.frame) + SpaceMargin, 0, headWidth, TableHeight))];
    self.countLabel.textAlignment = NSTextAlignmentLeft;
    self.countLabel.text = @"200";
    self.countLabel.textColor = GXF_CONTENT_COLOR;
    self.countLabel.font = GXF_SIXTEENTEH_SIZE;
    
    self.baseCountLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.countLabel.frame) + SpaceMargin, 0, headWidth, TableHeight))];
    self.baseCountLabel.textAlignment = NSTextAlignmentLeft;
    self.baseCountLabel.text = @"200";
    self.baseCountLabel.textColor = GXF_CONTENT_COLOR;
    self.baseCountLabel.font = GXF_SIXTEENTEH_SIZE;
    
    self.editBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.editBtn setImage:[UIImage imageNamed:@"selected"] forState:UIControlStateNormal];
    self.editBtn.frame = CGRectMake(ScreenSize.width - LeftWidth, 0, LeftWidth , TableHeight);
    self.editBtn.contentMode = UIViewContentModeScaleAspectFit;
    
    self.lineLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin,TableHeight-1, ScreenSize.width  - LeftMargin * 2, 1))];;
    self.lineLabel.backgroundColor = GXF_LINE_COLOR;
    
    [self.contentView addSubview:self.smallImageView];
    [self.contentView addSubview:self.seqLabel];
    [self.contentView addSubview:self.titleLabel];
    [self.contentView addSubview:self.standLabel];
    [self.contentView addSubview:self.countLabel];
    [self.contentView addSubview:self.baseCountLabel];

    [self.contentView addSubview:self.editBtn];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end