// // StockingGoodsCell.m // IBOSSmini // // Created by apple on 2017/5/17. // Copyright © 2017年 elongtian. All rights reserved. // #import "StockingGoodsCell.h" @implementation StockingGoodsCell /** 后台代码创建单元cell @param style <#style description#> @param reuseIdentifier <#reuseIdentifier description#> @return <#return value description#> */ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; return self; } - (void)setModel:(StockingModel *)m{ CGFloat heightLine = 1; CGFloat heightRow = 40; CGFloat lblx = 20; CGFloat lbly = 8; CGFloat lblwidth = 80; CGFloat lblheight = 25; CGFloat valuex = 90; CGFloat valuey = 8; CGFloat valuewidth = 120; CGFloat valueheight = 25; //title================== UIView *vTitle = [UIView new]; vTitle.frame=CGRectMake(0, 0, Screen_Width, 10); vTitle.backgroundColor = LineBackgroundColor; [self.contentView addSubview:vTitle]; //唯一编码================== UIView *vOnlyCode = [UIView new]; vOnlyCode.frame=CGRectMake(0, CGRectGetMaxY(vTitle.frame), Screen_Width, heightRow); [self.contentView addSubview:vOnlyCode]; UILabel *lblOnlyCode=[UILabel new]; lblOnlyCode.frame=CGRectMake(lblx, lbly, lblwidth, lblheight); lblOnlyCode.text=@"唯一编码:"; lblOnlyCode.textColor = [UIColor blackColor]; lblOnlyCode.font = [UIFont systemFontOfSize: TitleFontOfSize]; [vOnlyCode addSubview:lblOnlyCode]; UILabel *lblonlyCodeValue = [UILabel new]; lblonlyCodeValue.frame=CGRectMake(valuex, valuey, Screen_Width-valuex-lblx, valueheight); lblonlyCodeValue.font = [UIFont systemFontOfSize: TitleFontOfSize]; lblonlyCodeValue.text = m.onlyCode; [vOnlyCode addSubview:lblonlyCodeValue]; //分割线 UIView *viewBackgroud = [UIView new]; viewBackgroud.frame = CGRectMake(0, CGRectGetMaxY(vOnlyCode.frame), Screen_Width, heightLine); viewBackgroud.backgroundColor = LineBackgroundColor; [self.contentView addSubview:viewBackgroud]; //库存数量 等级================== UIView *vCountAndGrade = [UIView new]; vCountAndGrade.frame=CGRectMake(0, CGRectGetMaxY(viewBackgroud.frame), Screen_Width, heightRow); [self.contentView addSubview:vCountAndGrade]; UIView *vNo = [UIView new]; vNo.frame=CGRectMake(0, 0, Screen_Width/2, heightRow); [vCountAndGrade addSubview:vNo]; UILabel *lblno=[UILabel new]; lblno.frame=CGRectMake(lblx, lbly, lblwidth, lblheight); lblno.text=@"库存数量:"; lblno.textColor = [UIColor blackColor]; lblno.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize]; [vNo addSubview:lblno]; UILabel *lblNoValue = [UILabel new]; lblNoValue.frame=CGRectMake(valuex, valuey, Screen_Width - valuex - lblx, valueheight); lblNoValue.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize]; lblNoValue.text = m.quantity; [vNo addSubview:lblNoValue]; UIView *vGrade = [UIView new]; vGrade.frame=CGRectMake(Screen_Width/2, 0, Screen_Width/2, heightRow); [vCountAndGrade addSubview:vGrade]; UILabel *lblGrade=[UILabel new]; lblGrade.frame=CGRectMake(lblx, lbly, lblwidth/2, lblheight); lblGrade.text=@"等级:"; lblGrade.textColor = [UIColor blackColor]; lblGrade.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize]; [vGrade addSubview:lblGrade]; UILabel *gradeName = [UILabel new]; gradeName.frame=CGRectMake(CGRectGetMaxX(lblGrade.frame), valuey, valuewidth, valueheight); gradeName.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize]; gradeName.text = m.gradeName; [vGrade addSubview:gradeName]; //色号 规格================== UIView *vColorAndSpecification = [UIView new]; vColorAndSpecification.frame=CGRectMake(0, CGRectGetMaxY(vCountAndGrade.frame), Screen_Width, heightRow); [self.contentView addSubview:vColorAndSpecification]; UIView *vColor = [UIView new]; vColor.frame=CGRectMake(0, 0, Screen_Width/2, heightRow); [vColorAndSpecification addSubview:vColor]; UILabel *lblColor=[UILabel new]; lblColor.frame=CGRectMake(lblx, lbly, lblwidth/2, lblheight); lblColor.text=@"色号:"; lblColor.textColor = [UIColor blackColor]; lblColor.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize]; [vColor addSubview:lblColor]; UILabel *lblcolorNumber = [UILabel new]; lblcolorNumber.frame=CGRectMake(CGRectGetMaxX(lblColor.frame), valuey, valuewidth, valueheight); lblcolorNumber.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize]; lblcolorNumber.text = m.colorNumber; [vColor addSubview:lblcolorNumber]; UIView *vSpecification = [UIView new]; vSpecification.frame=CGRectMake(Screen_Width/2, 0, Screen_Width/2, heightRow); [vColorAndSpecification addSubview:vSpecification]; UILabel *lblSpecification=[UILabel new]; lblSpecification.frame=CGRectMake(lblx, lbly, lblwidth/2, lblheight); lblSpecification.text=@"规格:"; lblSpecification.textColor = [UIColor blackColor]; lblSpecification.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize]; [vSpecification addSubview:lblSpecification]; UILabel *specification = [UILabel new]; specification.frame=CGRectMake(CGRectGetMaxX(lblSpecification.frame), valuey, valuewidth, valueheight); specification.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize]; specification.text = m.specification; [vSpecification addSubview:specification]; //库区 仓位================== UIView *vWareAndPos = [UIView new]; vWareAndPos.frame=CGRectMake(0, CGRectGetMaxY(vColorAndSpecification.frame), Screen_Width, heightRow); [self.contentView addSubview:vWareAndPos]; UIView *vWare = [UIView new]; vWare.frame=CGRectMake(0, 0, Screen_Width/2, heightRow); [vWareAndPos addSubview:vWare]; UILabel *lblWare=[UILabel new]; lblWare.frame=CGRectMake(lblx, lbly, lblwidth/2, lblheight); lblWare.text=@"库区:"; lblWare.textColor = [UIColor blackColor]; lblWare.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize]; [vWare addSubview:lblWare]; UILabel *wareHouseName = [UILabel new]; wareHouseName.frame=CGRectMake(CGRectGetMaxX(lblWare.frame), valuey, valuewidth, valueheight); wareHouseName.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize]; wareHouseName.text = m.warehouseName; [vWare addSubview:wareHouseName]; UIView *vPos = [UIView new]; vPos.frame=CGRectMake(Screen_Width/2, 0, Screen_Width/2, heightRow); [vWareAndPos addSubview:vPos]; UILabel *lblPos=[UILabel new]; lblPos.frame=CGRectMake(lblx, lbly, lblwidth/2, lblheight); lblPos.text=@"仓位:"; lblPos.textColor = [UIColor blackColor]; lblPos.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize]; [vPos addSubview:lblPos]; UILabel *positionNumber = [UILabel new]; positionNumber.frame=CGRectMake(CGRectGetMaxX(lblPos.frame), valuey, valuewidth, valueheight); positionNumber.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize]; positionNumber.text = m.positionNumber; [vPos addSubview:positionNumber]; //分割线 viewBackgroud = [UIView new]; viewBackgroud.frame = CGRectMake(0, CGRectGetMaxY(vWareAndPos.frame), Screen_Width, 10); viewBackgroud.backgroundColor = LineBackgroundColor; //[self.contentView addSubview:viewBackgroud]; } @end