NoticeDetailCell.m 6.8 KB
Newer Older
zhu's avatar
zhu 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 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 121 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 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
//
//  NoticeDetailCell.m
//  XFFruit
//
//  Created by mac on 15/9/17.
//  Copyright (c) 2015年 Xummer. All rights reserved.
//

#import "NoticeDetailCell.h"
#define TitleSize 17
#define LeftMargin 15
#define TableHeight 46
#define TableWidth 60
#define LeftWidth 40
#define RightWidth 20
@implementation NoticeDetailCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self =  [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.isSelected=NO;
        [self initdata];
        [self bulidLayout];
    }
    return self;
}
-(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];;//备注
    self.shopDetailAry1=[NSArray arrayWithObjects: self.packageSpecification, self.foundationQuantity ,self.remark,nil];
    self.shopDetailAry2=[NSArray arrayWithObjects: self.packageQuantity, self.packageUnit ,nil];
}
- (void)bulidLayout
{
    CGFloat gipWidth = (ScreenSize.width-(LeftMargin+20)-RightWidth-2)/4;
    
    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))];
    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;
    
    self.SpLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin+20, 0, gipWidth, TableHeight))];
    self.SpLabel.textAlignment= NSTextAlignmentLeft;
    self.SpLabel.textColor = HexColor(@"666666");
    self.SpLabel.font = FontSize(TitleSize);
    
    //    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);
    
    self.BzggLabel=[[UILabel alloc]initWithFrame:CGRectMake(LeftMargin+20+gipWidth+1, 0, gipWidth, TableHeight)];
    self.BzggLabel.textAlignment= NSTextAlignmentLeft;
    self.BzggLabel.textColor = HexColor(@"666666");
    self.BzggLabel.font = FontSize(TitleSize);
    
    self.BzslLabel=[[UILabel alloc]initWithFrame:CGRectMake(LeftMargin+20+2*gipWidth+2, 0, gipWidth, TableHeight)];
    self.BzslLabel.textAlignment= NSTextAlignmentLeft;
    self.BzslLabel.textColor = HexColor(@"666666");
    self.BzslLabel.font = FontSize(TitleSize);
    
    
    self.subSview=[[UIView alloc]initWithFrame:CGRectMake(0, TableHeight, self.contentView.width, TableHeight*2)];
    self.YcgslLabel=[[UILabel alloc]initWithFrame:CGRectMake(LeftMargin+20+3*gipWidth+3, 0, gipWidth, TableHeight)];

    self.YcgslLabel.textAlignment= NSTextAlignmentLeft;
    self.YcgslLabel.textColor = HexColor(@"666666");
    self.YcgslLabel.font = FontSize(TitleSize);
    
    
    NSArray*array=[NSArray arrayWithObjects:@"包装规格:",@"基础数量:" ,@"备注:",nil];
    NSArray*array1=[NSArray arrayWithObjects:@"包装数量:",@"包装单位:" ,nil];
    
    
    for (int i=0; i<array.count; i++) {
        UILabel *lable=[[UILabel alloc]init];
        //        if (i==0) {
        lable.frame=CGRectMake(LeftWidth, i*TableHeight*2/4, (self.contentView.width-2*LeftMargin)/4, TableHeight*2/4);
        //        }
        lable.text=[array objectAtIndex:i];
        lable.font=FontSize(TitleSize-2);
        [lable setTextColor:GXF_PLACEHOLDER_COLOR];
        
        [self.subSview addSubview:lable];
        UILabel*shopeLable= [self.shopDetailAry1 objectAtIndex:i];
        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);
        }else{
            shopeLable.frame=CGRectMake(lable.frame.origin.x+lable.frame.size.width, lable.frame.origin.y,(self.contentView.width-2*LeftMargin)/4, TableHeight*2/4);
        }
        
        shopeLable.font=FontSize(TitleSize-2);
        [shopeLable setTextColor:GXF_PLACEHOLDER_COLOR];
        //        shopeLable.backgroundColor=[UIColor redColor];
        [self.subSview addSubview:shopeLable];
    }
    for (int i=0; i<array1.count; i++) {
        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)];
        
        lable.text=[array1 objectAtIndex:i];
        lable.font=FontSize(TitleSize-2);
        [lable setTextColor:GXF_PLACEHOLDER_COLOR];
        
        [self.subSview addSubview:lable];
        UILabel*shopeLable= [self.shopDetailAry2 objectAtIndex:i];
        shopeLable.frame=CGRectMake(lable.frame.origin.x+lable.frame.size.width, lable.frame.origin.y,(self.contentView.width-2*LeftMargin)/4, TableHeight*2/4);
        shopeLable.font=FontSize(TitleSize-2);
        [shopeLable setTextColor:GXF_PLACEHOLDER_COLOR];
        //        shopeLable.backgroundColor=[UIColor redColor];
        [self.subSview addSubview:shopeLable];
    }
    self.subSview.hidden=YES;
    
    self.button=[UIButton buttonWithType:UIButtonTypeCustom];
    [self.button setFrame:CGRectMake(ScreenSize.width-50, 0, 50, 50)];
    [self.button setImage:[UIImage imageNamed:@"edit"] forState:UIControlStateNormal];
    if (self.isButtonhidden) {
        self.button.hidden=YES;
    }
    [self.contentView addSubview:self.button];
    [self.contentView addSubview:self.subSview];
    [self.contentView addSubview:self.SpLabel];
    [self.contentView addSubview:self.DjLabel];
    [self.contentView addSubview:self.BzslLabel];
    [self.contentView addSubview:self.BzggLabel];
    [self.contentView  addSubview:self.HeardLabel];
    [self.contentView addSubview:self.arrowView];
    [self.contentView addSubview: self.YcgslLabel];
    
}
- (void)setTitleStr:(NSString *)str

{
    
    
    
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

@end