CartFrame.m 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. //
  2. // CartFrame.m
  3. // IBOSSmini
  4. //
  5. // Created by guan hong hou on 2017/5/18.
  6. // Copyright © 2017年 elongtian. All rights reserved.
  7. //
  8. #import "CartFrame.h"
  9. #import "NSString+Tools.h"
  10. @implementation CartFrame
  11. -(void)setOrderCartModel:(ShopCartItemModel *)cartItem{
  12. _cartModel=cartItem;
  13. CGFloat xpadding =10;
  14. CGFloat ypadding =10;
  15. NSDictionary *orderDict = @{NSFontAttributeName:orderTextFont};
  16. _btnCheckF=CGRectMake(xpadding, ypadding+3,25,25);
  17. NSString *productCode= [_cartModel code];
  18. if(productCode!=nil){
  19. CGRect productCodeFrame = [productCode textRectWithSize:CGSizeMake(150, MAXFLOAT) attributes:orderDict];
  20. productCodeFrame.origin.x =CGRectGetMaxX(_btnCheckF)+10;
  21. productCodeFrame.origin.y = ypadding+7;
  22. _lblProductCodeF = productCodeFrame;
  23. }
  24. _btnDeleteF=CGRectMake(Screen_Width-80, ypadding+3,80, 25);
  25. _topSeparatorF=CGRectMake(0,CGRectGetMaxY(_btnDeleteF)+13,Screen_Width, 1);
  26. NSString *titleBrand=@"品牌:";
  27. CGRect titleBrandFrame = [titleBrand textRectWithSize:CGSizeMake(150, MAXFLOAT) attributes:orderDict];
  28. titleBrandFrame.origin.x =xpadding+5;
  29. titleBrandFrame.origin.y = CGRectGetMaxY(_topSeparatorF)+10;
  30. _lblTitleBrandF = titleBrandFrame;
  31. NSString *brand=[_cartModel brandName];
  32. if(brand!=nil){
  33. CGRect brandFrame = [brand textRectWithSize:CGSizeMake(200, MAXFLOAT) attributes:orderDict];
  34. brandFrame.origin.x =CGRectGetMaxX(_lblTitleBrandF)+8;
  35. brandFrame.origin.y = CGRectGetMaxY(_topSeparatorF)+10;
  36. _lblBrandF = brandFrame;
  37. }
  38. NSString *titleOnlyCode=@"唯一编码:";
  39. CGRect titleOnlyCodeFrame = [titleOnlyCode textRectWithSize:CGSizeMake(100, MAXFLOAT) attributes:orderDict];
  40. titleOnlyCodeFrame.origin.x =Screen_Width/2;
  41. titleOnlyCodeFrame.origin.y = CGRectGetMaxY(_topSeparatorF)+10;
  42. _lblTitleOnlyCodeF=titleOnlyCodeFrame;
  43. NSString *onlyCode=[_cartModel onlyCode];
  44. if(onlyCode!=nil){
  45. CGRect onlyCodeFrame = [onlyCode textRectWithSize:CGSizeMake(150, MAXFLOAT) attributes:orderDict];
  46. onlyCodeFrame.origin.x =CGRectGetMaxX(_lblTitleOnlyCodeF)+8;
  47. onlyCodeFrame.origin.y = CGRectGetMaxY(_topSeparatorF)+10;
  48. _lblOnlyCodeF=onlyCodeFrame;
  49. }
  50. NSString *titleColorNumber=@"色号:";
  51. CGRect titleColorNumberFrame = [titleColorNumber textRectWithSize:CGSizeMake(100, MAXFLOAT) attributes:orderDict];
  52. titleColorNumberFrame.origin.x =xpadding+5;
  53. titleColorNumberFrame.origin.y = CGRectGetMaxY(_lblTitleBrandF)+10;
  54. _lblTitleColorNumberF= titleColorNumberFrame;
  55. NSString *colorNumber=[_cartModel colorNumber];
  56. CGRect colorNumberFrame = [colorNumber textRectWithSize:CGSizeMake(150, MAXFLOAT) attributes:orderDict];
  57. colorNumberFrame.origin.x =CGRectGetMaxX(_lblTitleColorNumberF)+8;
  58. colorNumberFrame.origin.y = CGRectGetMaxY(_lblTitleBrandF)+10;
  59. _lblColorNumberF=colorNumberFrame;
  60. NSString *titleSpecification=@"规格:";
  61. CGRect titleSpecificationFrame = [titleSpecification textRectWithSize:CGSizeMake(100, MAXFLOAT) attributes:orderDict];
  62. titleSpecificationFrame.origin.x =Screen_Width/3;
  63. titleSpecificationFrame.origin.y = CGRectGetMaxY(_lblTitleBrandF)+10;
  64. _lblTitleSpecificationF= titleSpecificationFrame;
  65. NSString *specification=[_cartModel specification];
  66. CGRect specificationFrame = [specification textRectWithSize:CGSizeMake(200, MAXFLOAT) attributes:orderDict];
  67. specificationFrame.origin.x =CGRectGetMaxX(titleSpecificationFrame)+8;
  68. specificationFrame.origin.y = CGRectGetMaxY(_lblTitleBrandF)+10;
  69. _lblSpecificationF= specificationFrame;
  70. NSString *titleGrade=@"等级:";
  71. CGRect titleGradeFrame = [titleGrade textRectWithSize:CGSizeMake(100, MAXFLOAT) attributes:orderDict];
  72. titleGradeFrame.origin.x =(Screen_Width/3)*2;
  73. titleGradeFrame.origin.y = CGRectGetMaxY(_lblTitleBrandF)+10;
  74. _lblTitleGradeF=titleGradeFrame;
  75. NSString *grade=[_cartModel gradeName];
  76. CGRect gradeFrame = [grade textRectWithSize:CGSizeMake(200, MAXFLOAT) attributes:orderDict];
  77. gradeFrame.origin.x =CGRectGetMaxX(titleGradeFrame)+8;
  78. gradeFrame.origin.y = CGRectGetMaxY(_lblTitleBrandF)+10;
  79. _lblGradeF=gradeFrame;
  80. NSString *titleWarehouseArea=@"库区:";
  81. CGRect titleWarehouseAreaFrame = [titleWarehouseArea textRectWithSize:CGSizeMake(100, MAXFLOAT) attributes:orderDict];
  82. titleWarehouseAreaFrame.origin.x =xpadding+5;
  83. titleWarehouseAreaFrame.origin.y = CGRectGetMaxY(_lblTitleColorNumberF)+10;
  84. _lblTitleWareHouseAreaF= titleWarehouseAreaFrame;
  85. NSString *warehouseArea=[_cartModel warehouseName];
  86. CGRect warehouseAreaFrame = [warehouseArea textRectWithSize:CGSizeMake(200, MAXFLOAT) attributes:orderDict];
  87. warehouseAreaFrame.origin.x =CGRectGetMaxX(_lblTitleWareHouseAreaF)+8;
  88. warehouseAreaFrame.origin.y = CGRectGetMaxY(_lblTitleColorNumberF)+10;
  89. _lblWareHouseAreaF=warehouseAreaFrame;
  90. _middleSeparatorF=CGRectMake(0,CGRectGetMaxY(_lblTitleWareHouseAreaF)+10,Screen_Width, 1);
  91. _btnSubstractQuantityF=CGRectMake(Screen_Width-220,CGRectGetMaxY(_middleSeparatorF)+5,25,25);
  92. _txtQuantityF=CGRectMake(CGRectGetMaxX(_btnSubstractQuantityF)-1,CGRectGetMaxY(_middleSeparatorF)+5,150,25);
  93. _btnAddQuantityF=CGRectMake(CGRectGetMaxX(_txtQuantityF)-1,CGRectGetMaxY(_middleSeparatorF)+5,25,25);
  94. _bottomSeparatorF=CGRectMake(0,CGRectGetMaxY(_btnSubstractQuantityF)+5,Screen_Width, 10);
  95. _cellHeight=CGRectGetMaxY(_bottomSeparatorF);
  96. }
  97. @end