MaterialCell.m 6.82 KB
Newer Older
n22's avatar
n22 committed
1 2 3 4 5 6 7 8 9 10 11
//
//  MaterialCell.m
//  XFFruit
//
//  Created by n22 on 15/8/19.
//  Copyright (c) 2015年 Xummer. All rights reserved.
//

#import "MaterialCell.h"
#define LeftMargin 13
#define TableHeight 44
n22's avatar
n22 committed
12 13
#define SmallSize 15
#define SmallWidth 20
n22's avatar
n22 committed
14
#define SpaceMargin 1
n22's avatar
n22 committed
15 16
#define LeftWidth 45
#define RightWidth 30
n22's avatar
n22 committed
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36


#define ShowColor @"bbbbbb"
#define ShowSize 13
#define ShowWidth 150
#define ShowHeight 20

@implementation MaterialCell

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

- (void)bulidLayout
{
n22's avatar
n22 committed
37
    CGFloat headWidth = (ScreenSize.width - LeftWidth - RightWidth - SpaceMargin* (3 -1))/3;
n22's avatar
n22 committed
38 39 40 41
    
    self.smallImageView = [[UIImageView alloc]initWithFrame:CGRectMake(LeftMargin, (TableHeight - SmallSize)/2 , SmallSize, SmallSize)];
    self.smallImageView.image = [UIImage imageNamed:@"delete"];
    
n22's avatar
n22 committed
42
    self.seqLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.smallImageView.frame), 0, SmallWidth, TableHeight))];
陈俊俊's avatar
陈俊俊 committed
43
    self.seqLabel.textColor = GXF_CONTENT_COLOR;
n22's avatar
n22 committed
44
    self.seqLabel.text = @"13";
陈俊俊's avatar
陈俊俊 committed
45
    self.seqLabel.font = GXF_SIXTEENTEH_SIZE;
n22's avatar
n22 committed
46 47
    
    self.titleLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftWidth, 0, headWidth, TableHeight))];
n22's avatar
n22 committed
48
    self.titleLabel.textAlignment = NSTextAlignmentLeft;
陈俊俊's avatar
陈俊俊 committed
49
    self.titleLabel.textColor = GXF_CONTENT_COLOR;
n22's avatar
n22 committed
50
    self.titleLabel.text = @"苹果桃子";
陈俊俊's avatar
陈俊俊 committed
51
    self.titleLabel.font = GXF_SIXTEENTEH_SIZE;
n22's avatar
n22 committed
52 53
    
    self.baseCountLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.titleLabel.frame) + SpaceMargin, 0, headWidth, TableHeight))];
n22's avatar
n22 committed
54
    self.baseCountLabel.textAlignment = NSTextAlignmentLeft;
陈俊俊's avatar
陈俊俊 committed
55
    self.baseCountLabel.textColor = GXF_CONTENT_COLOR;
n22's avatar
n22 committed
56
    self.baseCountLabel.text = @"30000";
陈俊俊's avatar
陈俊俊 committed
57
    self.baseCountLabel.font = GXF_SIXTEENTEH_SIZE;
n22's avatar
n22 committed
58 59
    
    self.dateLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.baseCountLabel.frame) + SpaceMargin, 0, headWidth, TableHeight))];
n22's avatar
n22 committed
60
    self.dateLabel.textAlignment = NSTextAlignmentLeft;
n22's avatar
n22 committed
61
    self.dateLabel.text = @"2015-04-05";
陈俊俊's avatar
陈俊俊 committed
62 63
    self.dateLabel.textColor = GXF_CONTENT_COLOR;
    self.dateLabel.font = GXF_SIXTEENTEH_SIZE;
n22's avatar
n22 committed
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
    
    self.showView = [[UIView alloc]initWithFrame:CGRectMake(0, TableHeight, ScreenSize.width, 0)];
    self.showView.hidden = YES;
    
    self.showTitleLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin + SmallSize, 0, ShowWidth, ShowHeight))];
    self.showTitleLabel.textAlignment = NSTextAlignmentLeft;
    self.showTitleLabel.textColor = HexColor(ShowColor);
    self.showTitleLabel.text = @"原料:苹果桃子";
    self.showTitleLabel.font = FontSize(ShowSize);
    
    self.showBaseCountLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.showTitleLabel.frame), 0, ShowWidth, ShowHeight))];
    self.showBaseCountLabel.textAlignment = NSTextAlignmentLeft;
    self.showBaseCountLabel.textColor = HexColor(ShowColor);
    self.showBaseCountLabel.text = @"基础数量:10000";
    self.showBaseCountLabel.font = FontSize(ShowSize);
    
    self.showDateLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.showTitleLabel.frame), CGRectGetMaxY(self.showTitleLabel.frame), ShowWidth, ShowHeight))];
    self.showDateLabel.textAlignment = NSTextAlignmentLeft;
    self.showDateLabel.textColor = HexColor(ShowColor);
    self.showDateLabel.text = @"入库时间:2015-02-04";
    self.showDateLabel.font = FontSize(ShowSize);
    
    self.basePriceLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.showBaseCountLabel.frame), CGRectGetMaxY(self.showTitleLabel.frame), ShowWidth, ShowHeight))];
    self.basePriceLabel.textAlignment = NSTextAlignmentLeft;
    self.basePriceLabel.textColor = HexColor(ShowColor);
    self.basePriceLabel.text = @"基础单价:11元";
    self.basePriceLabel.font = FontSize(ShowSize);
    
    self.totalPriceLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.showTitleLabel.frame), CGRectGetMaxY(self.showDateLabel.frame), ShowWidth, ShowHeight))];
    self.totalPriceLabel.textAlignment = NSTextAlignmentLeft;
    self.totalPriceLabel.textColor = HexColor(ShowColor);
    self.totalPriceLabel.text = @"总金额:1000";
    self.totalPriceLabel.font = FontSize(ShowSize);
    
    self.placeLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.showBaseCountLabel.frame), CGRectGetMaxY(self.showDateLabel.frame), ShowWidth, ShowHeight))];
    self.placeLabel.textAlignment = NSTextAlignmentLeft;
    self.placeLabel.textColor = HexColor(ShowColor);
    self.placeLabel.text = @"产地:河南省";
    self.placeLabel.font = FontSize(ShowSize);
    
    self.qualityLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.showTitleLabel.frame), CGRectGetMaxY(self.totalPriceLabel.frame), ShowWidth, ShowHeight))];
    self.qualityLabel.textAlignment = NSTextAlignmentLeft;
    self.qualityLabel.textColor = HexColor(ShowColor);
    self.qualityLabel.text = @"质量:1000";
    self.qualityLabel.font = FontSize(ShowSize);
    
    self.remarkLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.showTitleLabel.frame), CGRectGetMaxY(self.qualityLabel.frame), ShowWidth, ShowHeight))];
    self.remarkLabel.textAlignment = NSTextAlignmentLeft;
    self.remarkLabel.textColor = HexColor(ShowColor);
    self.remarkLabel.text = @"描述:河南省";
    self.remarkLabel.font = FontSize(ShowSize);
    
    self.editBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.editBtn setImage:[UIImage imageNamed:@"delete"] forState:UIControlStateNormal];
    self.editBtn.frame = CGRectMake(ScreenSize.width - LeftWidth, 0, LeftWidth, TableHeight);
    
    self.lineLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin,TableHeight-1, ScreenSize.width  - LeftMargin * 2, 1))];;
陈俊俊's avatar
陈俊俊 committed
121
    self.lineLabel.backgroundColor = GXF_LINE_COLOR;
n22's avatar
n22 committed
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
    [self.contentView addSubview:self.smallImageView];
    [self.contentView addSubview:self.seqLabel];
    [self.contentView addSubview:self.titleLabel];
    [self.contentView addSubview:self.baseCountLabel];
    [self.contentView addSubview:self.dateLabel];
    [self.contentView addSubview:self.editBtn];
    [self.contentView addSubview:self.showView];

    [self.showView addSubview:self.showTitleLabel];
    [self.showView addSubview:self.showBaseCountLabel];
    [self.showView addSubview:self.showDateLabel];
    [self.showView addSubview:self.basePriceLabel];
    [self.showView addSubview:self.totalPriceLabel];
    [self.showView addSubview:self.placeLabel];
    [self.showView addSubview:self.qualityLabel];
    [self.showView addSubview:self.remarkLabel];
    [self.contentView addSubview:self.lineLabel];
}


- (void)awakeFromNib {
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}

@end