InventoryAnalysisDataListCell.m 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. //
  2. // InventoryAnalysisDataListCell.m
  3. // IBOSS
  4. //
  5. // Created by ssl on 2018/1/4.
  6. // Copyright © 2018年 elongtian. All rights reserved.
  7. //
  8. #import "InventoryAnalysisDataListCell.h"
  9. #define kTextFont [UIFont systemFontOfSize:TitleFontOfSize]
  10. @interface InventoryAnalysisDataListCell(){
  11. UILabel *_lbObjectName;
  12. UILabel *_lbProportion;
  13. UILabel *_lbCanSaleQuantity;
  14. UILabel *_lbInventoryQuantity;
  15. UIView *_line;
  16. }
  17. @end
  18. @implementation InventoryAnalysisDataListCell
  19. - (void)awakeFromNib {
  20. [super awakeFromNib];
  21. }
  22. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  23. }
  24. /**
  25. 初始化控件
  26. */
  27. -(void)initUI{
  28. _lbObjectName = [[UILabel alloc] init];
  29. _lbObjectName.frame = CGRectMake(15, 15, 0, 0);
  30. [self.contentView addSubview:_lbObjectName];
  31. _lbProportion = [[UILabel alloc] init];
  32. [self.contentView addSubview:_lbProportion];
  33. _lbCanSaleQuantity = [[UILabel alloc] init];
  34. [self.contentView addSubview:_lbCanSaleQuantity];
  35. _lbInventoryQuantity = [[UILabel alloc] init];
  36. [self.contentView addSubview:_lbInventoryQuantity];
  37. _line = [[UIView alloc] init];
  38. _line.backgroundColor = LineBackgroundColor;
  39. [self.contentView addSubview:_line];
  40. _lbObjectName.font = kTextFont;
  41. _lbProportion.font = kTextFont;
  42. _lbCanSaleQuantity.font = kTextFont;
  43. _lbInventoryQuantity.font = kTextFont;
  44. _lbProportion.textColor = LabelGrayTextColor;
  45. _lbInventoryQuantity.textColor = LabelGrayTextColor;
  46. }
  47. /**
  48. 刷新数据
  49. @param model <#model description#>
  50. */
  51. -(void)loadData:(SalesPaymentRankModel *) model{
  52. _lbObjectName.text = model.objectName;
  53. [_lbObjectName sizeToFit];
  54. _lbProportion.text = [NSString stringWithFormat:@"%@%@%@",@"所在比重:",model.backPercent,@"%"];
  55. [_lbProportion sizeToFit];
  56. _lbProportion.frame = CGRectMake(SCREENWIDTH - CGRectGetWidth(_lbProportion.frame) - 15, 15, CGRectGetWidth(_lbProportion.frame), CGRectGetHeight(_lbProportion.frame));
  57. _lbCanSaleQuantity.text = [NSString stringWithFormat:@"%@%@",@"可售量:",model.canSaleQuantity];
  58. [_lbCanSaleQuantity sizeToFit];
  59. _lbCanSaleQuantity.frame = CGRectMake(SCREENWIDTH -CGRectGetWidth(_lbCanSaleQuantity.frame)-15, CGRectGetMaxY(_lbObjectName.frame)+15, CGRectGetWidth(_lbCanSaleQuantity.frame), CGRectGetHeight(_lbCanSaleQuantity.frame));
  60. _lbInventoryQuantity.text = [NSString stringWithFormat:@"%@%@",@"结存量:",model.inventoryQuantity];
  61. [_lbInventoryQuantity sizeToFit];
  62. _lbInventoryQuantity.frame = CGRectMake(15, CGRectGetMaxY(_lbObjectName.frame)+15, CGRectGetWidth(_lbInventoryQuantity.frame), CGRectGetHeight(_lbInventoryQuantity.frame));
  63. _line.frame = CGRectMake(0, CGRectGetMaxY(_lbInventoryQuantity.frame)+10, SCREENWIDTH, 1);
  64. }
  65. @end