PurchaseNoticeCell.m 6.44 KB
Newer Older
朱朝吉's avatar
朱朝吉 committed
1 2 3 4 5 6 7 8 9
//
//  PurchaseNoticeCell.m
//  XFFruit
//
//  Created by mac on 15/8/18.
//  Copyright (c) 2015年 Xummer. All rights reserved.
//

#import "PurchaseNoticeCell.h"
zhu's avatar
zhu committed
10
#define TitleSize 17
朱朝吉's avatar
朱朝吉 committed
11
#define LeftMargin 15
zhu's avatar
zhu committed
12 13
#define TableHeight 46
#define TableWidth 60
zhu's avatar
zhu committed
14 15
#define LeftWidth 40
#define RightWidth 30
zhu's avatar
zhu committed
16

朱朝吉's avatar
朱朝吉 committed
17 18 19 20 21 22
@implementation PurchaseNoticeCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self =  [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
zhu's avatar
zhu committed
23
        self.isSelected=NO;
zhu's avatar
zhu committed
24
        [self initdata];
朱朝吉's avatar
朱朝吉 committed
25 26 27 28
        [self bulidLayout];
    }
    return self;
}
zhu's avatar
zhu committed
29 30 31 32 33 34 35 36 37 38
-(void)initdata
{
     self.packageSpecification=[[UILabel alloc]init];//包装规格
     self.packageQuantity=[[UILabel alloc]init];;//包装数量
     self.packageUnit=[[UILabel alloc]init]; ;//包装单位
     self.foundationQuantity=[[UILabel alloc]init];;//基础数量
     self.foundationUnitPrice=[[UILabel alloc]init];;//基础单价
     self.packageUnitPrice=[[UILabel alloc]init];;//包装单价
     self.totalMoney=[[UILabel alloc]init];;//总金额
     self.remark=[[UILabel alloc]init];;//备注
zhu's avatar
zhu committed
39 40
    self.shopDetailAry1=[NSArray arrayWithObjects: self.packageSpecification, self.foundationQuantity ,self.remark,nil];
     self.shopDetailAry2=[NSArray arrayWithObjects: self.packageQuantity, self.packageUnit ,nil];
zhu's avatar
zhu committed
41
}
朱朝吉's avatar
朱朝吉 committed
42 43
- (void)bulidLayout
{
zhu's avatar
zhu committed
44
    CGFloat gipWidth = (ScreenSize.width-(LeftMargin+20)-RightWidth-2)/3;
zhu's avatar
zhu committed
45 46 47 48 49
    self.HeardLabel=[[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, 0, ScreenSize.width - LeftMargin * 2, 1))];
    self.HeardLabel.backgroundColor = HexColor(@"e5e5e5");
    self.HeardLabel.font = FontSize(TitleSize);
    
    self.FootLabel=[[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, self.size.height-1, ScreenSize.width - LeftMargin * 2, 1))];
zhu's avatar
zhu committed
50 51 52 53 54 55
    self.FootLabel.backgroundColor = HexColor(@"e5e5e5");
    self.FootLabel.font = FontSize(TitleSize);
    
    self.arrowView=[[UIImageView alloc]initWithFrame:CGRectMake(LeftMargin, (TableHeight - 10)/2 , 10, 10)];
    self.arrowView.image = [UIImage imageNamed:@"arrowright"];
    self.arrowView.contentMode = UIViewContentModeScaleAspectFit;
朱朝吉's avatar
朱朝吉 committed
56
    
zhu's avatar
zhu committed
57
    self.SpLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin+20, 0, gipWidth, TableHeight))];
朱朝吉's avatar
朱朝吉 committed
58 59 60 61
    self.SpLabel.textAlignment= NSTextAlignmentLeft;
    self.SpLabel.textColor = HexColor(@"666666");
    self.SpLabel.font = FontSize(TitleSize);
    
zhu's avatar
zhu committed
62 63 64 65
//    self.DjLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin+20+self.SpLabel.size.width+gipWidth , 0,  TableWidth,TableHeight ))];
//    self.DjLabel.textAlignment= NSTextAlignmentLeft;
//    self.DjLabel.textColor = HexColor(@"666666");
//    self.DjLabel.font = FontSize(TitleSize);
朱朝吉's avatar
朱朝吉 committed
66
    
zhu's avatar
zhu committed
67
    self.BzggLabel=[[UILabel alloc]initWithFrame:CGRectMake(LeftMargin+20+gipWidth+1, 0, gipWidth, TableHeight)];
zhu's avatar
zhu committed
68 69 70 71
    self.BzggLabel.textAlignment= NSTextAlignmentLeft;
    self.BzggLabel.textColor = HexColor(@"666666");
    self.BzggLabel.font = FontSize(TitleSize);
    
zhu's avatar
zhu committed
72
    self.BzslLabel=[[UILabel alloc]initWithFrame:CGRectMake(LeftMargin+20+2*gipWidth+2, 0, gipWidth, TableHeight)];
zhu's avatar
zhu committed
73 74 75 76
    self.BzslLabel.textAlignment= NSTextAlignmentLeft;
    self.BzslLabel.textColor = HexColor(@"666666");
    self.BzslLabel.font = FontSize(TitleSize);
    
zhu's avatar
zhu committed
77

zhu's avatar
zhu committed
78
    self.subSview=[[UIView alloc]initWithFrame:CGRectMake(0, TableHeight, self.contentView.width, TableHeight*2)];
zhu's avatar
zhu committed
79 80 81
    
   
    
zhu's avatar
zhu committed
82
    NSArray*array=[NSArray arrayWithObjects:@"包装规格:",@"基础数量:" ,@"备注:",nil];
zhu's avatar
zhu committed
83
    NSArray*array1=[NSArray arrayWithObjects:@"包装数量:",@"包装单位:" ,nil];
zhu's avatar
zhu committed
84
    
zhu's avatar
zhu committed
85 86
    
    for (int i=0; i<array.count; i++) {
zhu's avatar
zhu committed
87 88
        UILabel *lable=[[UILabel alloc]init];
//        if (i==0) {
zhu's avatar
zhu committed
89
            lable.frame=CGRectMake(LeftWidth, i*TableHeight*2/4, (self.contentView.width-2*LeftMargin)/4, TableHeight*2/4);
zhu's avatar
zhu committed
90
//        }
zhu's avatar
zhu committed
91
              lable.text=[array objectAtIndex:i];
zhu's avatar
zhu committed
92
        lable.font=FontSize(TitleSize-2);
陈俊俊's avatar
陈俊俊 committed
93
        [lable setTextColor:GXF_PLACEHOLDER_COLOR];
zhu's avatar
zhu committed
94
       
zhu's avatar
zhu committed
95
        [self.subSview addSubview:lable];
zhu's avatar
zhu committed
96
        UILabel*shopeLable= [self.shopDetailAry1 objectAtIndex:i];
zhu's avatar
zhu committed
97 98
        if (i==2) {
            shopeLable.frame=CGRectMake(lable.frame.origin.x+lable.frame.size.width, lable.frame.origin.y,(self.contentView.width-2*LeftMargin)/4*3, TableHeight*2/4);
zhu's avatar
zhu committed
99
        }else{
zhu's avatar
zhu committed
100
             shopeLable.frame=CGRectMake(lable.frame.origin.x+lable.frame.size.width, lable.frame.origin.y,(self.contentView.width-2*LeftMargin)/4, TableHeight*2/4);
zhu's avatar
zhu committed
101 102 103
        }
       
        shopeLable.font=FontSize(TitleSize-2);
陈俊俊's avatar
陈俊俊 committed
104
        [shopeLable setTextColor:GXF_PLACEHOLDER_COLOR];
zhu's avatar
zhu committed
105 106
//        shopeLable.backgroundColor=[UIColor redColor];
        [self.subSview addSubview:shopeLable];
zhu's avatar
zhu committed
107 108
    }
    for (int i=0; i<array1.count; i++) {
zhu's avatar
zhu committed
109
        UILabel *lable=[[UILabel alloc]initWithFrame:CGRectMake(LeftWidth+(self.contentView.width-2*LeftMargin)/2, i*TableHeight*2/4, (self.contentView.width-2*LeftMargin)/4, TableHeight*2/4)];
zhu's avatar
zhu committed
110 111
       
        lable.text=[array1 objectAtIndex:i];
zhu's avatar
zhu committed
112
        lable.font=FontSize(TitleSize-2);
陈俊俊's avatar
陈俊俊 committed
113
        [lable setTextColor:GXF_PLACEHOLDER_COLOR];
zhu's avatar
zhu committed
114
        
zhu's avatar
zhu committed
115
        [self.subSview addSubview:lable];
zhu's avatar
zhu committed
116
        UILabel*shopeLable= [self.shopDetailAry2 objectAtIndex:i];
zhu's avatar
zhu committed
117
        shopeLable.frame=CGRectMake(lable.frame.origin.x+lable.frame.size.width, lable.frame.origin.y,(self.contentView.width-2*LeftMargin)/4, TableHeight*2/4);
zhu's avatar
zhu committed
118
        shopeLable.font=FontSize(TitleSize-2);
陈俊俊's avatar
陈俊俊 committed
119
        [shopeLable setTextColor:GXF_PLACEHOLDER_COLOR];
zhu's avatar
zhu committed
120 121
//        shopeLable.backgroundColor=[UIColor redColor];
        [self.subSview addSubview:shopeLable];
zhu's avatar
zhu committed
122 123 124 125
    }
    self.subSview.hidden=YES;
    
    self.button=[UIButton buttonWithType:UIButtonTypeCustom];
zhu's avatar
zhu committed
126
    [self.button setFrame:CGRectMake(ScreenSize.width-50, 0, 50, 50)];
zhu's avatar
zhu committed
127
    [self.button setImage:[UIImage imageNamed:@"edit"] forState:UIControlStateNormal];
zhu's avatar
zhu committed
128 129 130
    if (self.isButtonhidden) {
        self.button.hidden=YES;
    }
zhu's avatar
zhu committed
131
    [self.contentView addSubview:self.button];
陈俊俊's avatar
陈俊俊 committed
132
    [self.contentView addSubview:self.subSview];
朱朝吉's avatar
朱朝吉 committed
133 134 135 136
    [self.contentView addSubview:self.SpLabel];
    [self.contentView addSubview:self.DjLabel];
    [self.contentView addSubview:self.BzslLabel];
    [self.contentView addSubview:self.BzggLabel];
zhu's avatar
zhu committed
137
    [self.contentView  addSubview:self.HeardLabel];
zhu's avatar
zhu committed
138
    [self.contentView addSubview:self.arrowView];
朱朝吉's avatar
朱朝吉 committed
139 140
}
- (void)setTitleStr:(NSString *)str
zhu's avatar
zhu committed
141

朱朝吉's avatar
朱朝吉 committed
142
{
zhu's avatar
zhu committed
143 144 145
  
   
   
陈俊俊's avatar
陈俊俊 committed
146
}
朱朝吉's avatar
朱朝吉 committed
147 148 149 150 151 152 153 154 155 156 157
- (void)awakeFromNib {
    // Initialization code
}

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

    // Configure the view for the selected state
}

@end