| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231 |
- //
- // OtherInStorageGoodsSearchCell.m
- // IBOSSmini
- //
- // Created by guan hong hou on 2018/4/25.
- // Copyright © 2018年 elongtian. All rights reserved.
- //
- #import "OtherInStorageGoodsSearchCell.h"
- @implementation OtherInStorageGoodsSearchCell
- #pragma mark 公共函数
- /**
- 加载tableview 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)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
- }
- #pragma mark 私有函数
- /**
- 初始化cell UI和数据
- @param goodsSearchListModel <#goodsSearchListModel description#>
- */
- -(void) setOtherInStorageGoodsSearchModel:(OtherInStorageGoodsSearchListModel*)goodsSearchListModel{
-
- _otherGoodsSearchListModel=goodsSearchListModel;
- if(_otherGoodsSearchListModel==nil){
- return;
- }
-
- CGFloat heightLine = 1;
- CGFloat heightRow = 40;
- CGFloat lblx = 20;
- CGFloat lbly = 8;
- CGFloat lblwidth = 70;
- CGFloat lblheight = 25;
- CGFloat valuey = 8;
- CGFloat valueheight = 25;
-
- UIView *vGoodsName = [UIView new];
- vGoodsName.frame=CGRectMake(0, valuey, Screen_Width, heightRow);
- [self.contentView addSubview:vGoodsName];
- _btnCheck=[UIButton buttonWithType:UIButtonTypeCustom];
- _btnCheck.frame=CGRectMake(lblx,valuey, 25, 25);
- [_btnCheck addTarget:self action:@selector(btnGoCheck) forControlEvents:UIControlEventTouchUpInside];
- [vGoodsName addSubview:_btnCheck];
-
- _lblGoodsName = [UILabel new];
- _lblGoodsName.frame=CGRectMake(CGRectGetMaxX(_btnCheck.frame)+10, valuey, Screen_Width-CGRectGetMaxX(_btnCheck.frame), valueheight);
- _lblGoodsName.textColor = [UIColor blackColor];
- _lblGoodsName.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vGoodsName addSubview:_lblGoodsName];
- _lblGoodsName.text = _otherGoodsSearchListModel.goodsName;
- //分割线
- _topSeparator= [UIView new];
- _topSeparator.frame = CGRectMake(0, CGRectGetMaxY(vGoodsName.frame), Screen_Width, heightLine);
-
- [self.contentView addSubview:_topSeparator];
- UIButton *btnLine = [UIButton buttonWithType:UIButtonTypeCustom];
- [btnLine setBackgroundImage:[UIImage imageNamed:@"dash"] forState:UIControlStateNormal];
- btnLine.frame = CGRectMake(0 ,0 , Screen_Width, heightLine);
- [_topSeparator addSubview:btnLine];
-
- //商品编码
- UIView *vGoodsCode = [UIView new];
- vGoodsCode.frame=CGRectMake(0, CGRectGetMaxY(_topSeparator.frame), Screen_Width/2, heightRow);
- [self.contentView addSubview:vGoodsCode];
- UILabel *lblGoodsCodeTitle=[UILabel new];
- lblGoodsCodeTitle.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
- lblGoodsCodeTitle.text=@"商品编码:";
- lblGoodsCodeTitle.textColor = [UIColor blackColor];
- lblGoodsCodeTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vGoodsCode addSubview:lblGoodsCodeTitle];
- _lblGoodsCode = [UILabel new];
- _lblGoodsCode.frame=CGRectMake(CGRectGetMaxX(lblGoodsCodeTitle.frame), valuey, Screen_Width/2 -CGRectGetMaxX(lblGoodsCodeTitle.frame), valueheight);
- _lblGoodsCode.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vGoodsCode addSubview:_lblGoodsCode];
- _lblGoodsCode.text = _otherGoodsSearchListModel.code;
-
-
- UIView *vOnlyCode = [UIView new];
- vOnlyCode.frame=CGRectMake(Screen_Width / 2, CGRectGetMaxY(_topSeparator.frame), Screen_Width / 2, heightRow);
- [self.contentView addSubview: vOnlyCode];
- UILabel *lblOnlyCodeTitle=[UILabel new];
- lblOnlyCodeTitle.frame=CGRectMake(5, lbly, lblwidth, lblheight);
- lblOnlyCodeTitle.text=@"唯一编码:";
- lblOnlyCodeTitle.textColor = [UIColor blackColor];
- lblOnlyCodeTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vOnlyCode addSubview:lblOnlyCodeTitle];
-
- _lblOnlyCode= [UILabel new];
- _lblOnlyCode.frame=CGRectMake(CGRectGetMaxX(lblOnlyCodeTitle.frame), valuey, Screen_Width/2-lblwidth-5 , valueheight);
- _lblOnlyCode.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vOnlyCode addSubview:_lblOnlyCode];
- _lblOnlyCode.text = _otherGoodsSearchListModel.onlyCode;
-
-
- UIView *vBrand = [UIView new];
- vBrand.frame=CGRectMake(0, CGRectGetMaxY(vGoodsCode.frame), Screen_Width/2, heightRow);
- [self.contentView addSubview:vBrand];
- UILabel *lblBrandTitle=[UILabel new];
- lblBrandTitle.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
- lblBrandTitle.text=@"品 牌:";
- lblBrandTitle.textColor = [UIColor blackColor];
- lblBrandTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vBrand addSubview:lblBrandTitle];
- _lblBrand = [UILabel new];
- _lblBrand.frame=CGRectMake(CGRectGetMaxX(lblBrandTitle.frame), valuey, Screen_Width/2 -CGRectGetMaxX(lblBrandTitle.frame), valueheight);
- _lblBrand.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vBrand addSubview:_lblBrand];
- _lblBrand.text = _otherGoodsSearchListModel.brandName;
-
- UIView *vKind = [UIView new];
- vKind.frame=CGRectMake(Screen_Width / 2, CGRectGetMaxY(vGoodsCode.frame), Screen_Width / 2, heightRow);
- [self.contentView addSubview: vKind];
- UILabel *lblKindTitle=[UILabel new];
- lblKindTitle.frame=CGRectMake(5, lbly, lblwidth, lblheight);
- lblKindTitle.text=@"种 类:";
- lblKindTitle.textColor = [UIColor blackColor];
- lblKindTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vKind addSubview:lblKindTitle];
-
- _lblKind= [UILabel new];
- _lblKind.frame=CGRectMake(CGRectGetMaxX(lblKindTitle.frame), valuey, Screen_Width/2-lblwidth-5 , valueheight);
- _lblKind.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vKind addSubview:_lblKind];
- _lblKind.text = _otherGoodsSearchListModel.kindName;
-
-
- UIView *vVariety = [UIView new];
- vVariety.frame=CGRectMake(0, CGRectGetMaxY(vBrand.frame), Screen_Width / 2, heightRow);
- [self.contentView addSubview: vVariety];
- UILabel *lblVarietyTitle=[UILabel new];
- lblVarietyTitle.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
- lblVarietyTitle.text=@"品 种:";
- lblVarietyTitle.textColor = [UIColor blackColor];
- lblVarietyTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vVariety addSubview:lblVarietyTitle];
-
- _lblVariety= [UILabel new];
- _lblVariety.frame=CGRectMake(CGRectGetMaxX(lblVarietyTitle.frame), valuey, Screen_Width/2-lblwidth-5 , valueheight);
- _lblVariety.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vVariety addSubview:_lblVariety];
- _lblVariety.text = _otherGoodsSearchListModel.varietyName;
-
- UIView *vSeries = [UIView new];
- vSeries.frame=CGRectMake(Screen_Width / 2, CGRectGetMaxY(vBrand.frame), Screen_Width / 2, heightRow);
- [self.contentView addSubview: vSeries];
- UILabel *lblSeriesTitle=[UILabel new];
- lblSeriesTitle.frame=CGRectMake(5, lbly, lblwidth, lblheight);
- lblSeriesTitle.text=@"系 列:";
- lblSeriesTitle.textColor = [UIColor blackColor];
- lblSeriesTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vSeries addSubview:lblSeriesTitle];
-
- _lblSeries= [UILabel new];
- _lblSeries.frame=CGRectMake(CGRectGetMaxX(lblSeriesTitle.frame), valuey, Screen_Width/2-lblwidth-5 , valueheight);
- _lblSeries.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vSeries addSubview:_lblSeries];
- _lblSeries.text = _otherGoodsSearchListModel.seriesName;
-
-
- UIView *vSpecification= [UIView new];
- vSpecification.frame=CGRectMake(0, CGRectGetMaxY(vVariety.frame), Screen_Width, heightRow);
- [self.contentView addSubview:vSpecification];
- UILabel *lblSpecificationTitle=[UILabel new];
- lblSpecificationTitle.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
- lblSpecificationTitle.text=@"规 格:";
- lblSpecificationTitle.textColor = [UIColor blackColor];
- lblSpecificationTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vSpecification addSubview:lblSpecificationTitle];
- _lblSpecification = [UILabel new];
- _lblSpecification.frame=CGRectMake(CGRectGetMaxX(lblSpecificationTitle.frame), valuey, vSpecification.frame.size.width -lblwidth-10, valueheight);
- _lblSpecification.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vSpecification addSubview:_lblSpecification];
- _lblSpecification.text = _otherGoodsSearchListModel.specification;
-
-
- _bottomSeparator= [UIView new];
- _bottomSeparator.frame=CGRectMake(0, CGRectGetMaxY(vSpecification.frame)+5, Screen_Width, 10);
- _bottomSeparator.backgroundColor = LineBackgroundColor;
- [self.contentView addSubview:_bottomSeparator];
-
- }
- /**
- check box点击事件
- */
- -(void)btnGoCheck
- {
- if([self.inStorageDelegate respondsToSelector:@selector(btnCheckPressed:)])
- {
- [self.inStorageDelegate btnCheckPressed:_index];
-
- }
- }
- //设置checkbox背景图片
- - (void) setCheckBackground: (BOOL) checked
- {
- if(!checked)
- {
-
- [_btnCheck setImage:[UIImage imageNamed:@"uncheck_round"] forState:UIControlStateNormal];
-
-
- }
- else
- {
-
- [_btnCheck setImage:[UIImage imageNamed:@"check_round"] forState:UIControlStateNormal];
-
- }
- }
- @end
|