// // InventoryAnalysisDataListCell.m // IBOSS // // Created by ssl on 2018/1/4. // Copyright © 2018年 elongtian. All rights reserved. // #import "InventoryAnalysisDataListCell.h" #define kTextFont [UIFont systemFontOfSize:TitleFontOfSize] @interface InventoryAnalysisDataListCell(){ UILabel *_lbObjectName; UILabel *_lbProportion; UILabel *_lbCanSaleQuantity; UILabel *_lbInventoryQuantity; UIView *_line; } @end @implementation InventoryAnalysisDataListCell - (void)awakeFromNib { [super awakeFromNib]; } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { } /** 初始化控件 */ -(void)initUI{ _lbObjectName = [[UILabel alloc] init]; _lbObjectName.frame = CGRectMake(15, 15, 0, 0); [self.contentView addSubview:_lbObjectName]; _lbProportion = [[UILabel alloc] init]; [self.contentView addSubview:_lbProportion]; _lbCanSaleQuantity = [[UILabel alloc] init]; [self.contentView addSubview:_lbCanSaleQuantity]; _lbInventoryQuantity = [[UILabel alloc] init]; [self.contentView addSubview:_lbInventoryQuantity]; _line = [[UIView alloc] init]; _line.backgroundColor = LineBackgroundColor; [self.contentView addSubview:_line]; _lbObjectName.font = kTextFont; _lbProportion.font = kTextFont; _lbCanSaleQuantity.font = kTextFont; _lbInventoryQuantity.font = kTextFont; _lbProportion.textColor = LabelGrayTextColor; _lbInventoryQuantity.textColor = LabelGrayTextColor; } /** 刷新数据 @param model <#model description#> */ -(void)loadData:(SalesPaymentRankModel *) model{ _lbObjectName.text = model.objectName; [_lbObjectName sizeToFit]; _lbProportion.text = [NSString stringWithFormat:@"%@%@%@",@"所在比重:",model.backPercent,@"%"]; [_lbProportion sizeToFit]; _lbProportion.frame = CGRectMake(SCREENWIDTH - CGRectGetWidth(_lbProportion.frame) - 15, 15, CGRectGetWidth(_lbProportion.frame), CGRectGetHeight(_lbProportion.frame)); _lbCanSaleQuantity.text = [NSString stringWithFormat:@"%@%@",@"可售量:",model.canSaleQuantity]; [_lbCanSaleQuantity sizeToFit]; _lbCanSaleQuantity.frame = CGRectMake(SCREENWIDTH -CGRectGetWidth(_lbCanSaleQuantity.frame)-15, CGRectGetMaxY(_lbObjectName.frame)+15, CGRectGetWidth(_lbCanSaleQuantity.frame), CGRectGetHeight(_lbCanSaleQuantity.frame)); _lbInventoryQuantity.text = [NSString stringWithFormat:@"%@%@",@"结存量:",model.inventoryQuantity]; [_lbInventoryQuantity sizeToFit]; _lbInventoryQuantity.frame = CGRectMake(15, CGRectGetMaxY(_lbObjectName.frame)+15, CGRectGetWidth(_lbInventoryQuantity.frame), CGRectGetHeight(_lbInventoryQuantity.frame)); _line.frame = CGRectMake(0, CGRectGetMaxY(_lbInventoryQuantity.frame)+10, SCREENWIDTH, 1); } @end