PurchaseNoticeCell.m 7.23 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"
陈俊俊's avatar
陈俊俊 committed
10
#define TitleSize 16
朱朝吉'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
-(void)initdata
{
zhu's avatar
zhu committed
31
     self.shopeName=[[UILabel alloc]init];//商品
zhu's avatar
zhu committed
32 33 34 35 36 37 38 39
     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
40 41
    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
42
}
朱朝吉's avatar
朱朝吉 committed
43 44
- (void)bulidLayout
{
zhu's avatar
zhu committed
45
    CGFloat gipWidth = (ScreenSize.width-(LeftMargin+20)-RightWidth-2)/3;
zhu's avatar
zhu committed
46 47 48
    self.shopeName.textAlignment= NSTextAlignmentLeft;
    self.shopeName.textColor = GXF_PLACEHOLDER_COLOR;
    self.shopeName.font = FontSize(TitleSize-2);
zhu's avatar
zhu committed
49 50 51 52 53
    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
54 55 56 57 58 59
    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
60
    
zhu's avatar
zhu committed
61
    self.SpLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin+20, 0, gipWidth, TableHeight))];
朱朝吉's avatar
朱朝吉 committed
62 63 64 65
    self.SpLabel.textAlignment= NSTextAlignmentLeft;
    self.SpLabel.textColor = HexColor(@"666666");
    self.SpLabel.font = FontSize(TitleSize);
    
zhu's avatar
zhu committed
66 67 68 69
//    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
70
    
zhu's avatar
zhu committed
71
    self.BzggLabel=[[UILabel alloc]initWithFrame:CGRectMake(LeftMargin+20+gipWidth+1, 0, gipWidth, TableHeight)];
zhu's avatar
zhu committed
72 73 74 75
    self.BzggLabel.textAlignment= NSTextAlignmentLeft;
    self.BzggLabel.textColor = HexColor(@"666666");
    self.BzggLabel.font = FontSize(TitleSize);
    
zhu's avatar
zhu committed
76
    self.BzslLabel=[[UILabel alloc]initWithFrame:CGRectMake(LeftMargin+20+2*gipWidth+2, 0, gipWidth, TableHeight)];
zhu's avatar
zhu committed
77 78 79 80
    self.BzslLabel.textAlignment= NSTextAlignmentLeft;
    self.BzslLabel.textColor = HexColor(@"666666");
    self.BzslLabel.font = FontSize(TitleSize);
    
zhu's avatar
zhu committed
81

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

朱朝吉's avatar
朱朝吉 committed
153
{
zhu's avatar
zhu committed
154 155 156
  
   
   
陈俊俊's avatar
陈俊俊 committed
157
}
朱朝吉's avatar
朱朝吉 committed
158 159 160 161 162 163 164 165 166 167 168
- (void)awakeFromNib {
    // Initialization code
}

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

    // Configure the view for the selected state
}

@end