AveragePriceMonitorFrame.m 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. //
  2. // AveragePriceMonitorModel.m
  3. // IBOSS
  4. //
  5. // Created by guan hong hou on 2017/9/8.
  6. // Copyright © 2017年 elongtian. All rights reserved.
  7. //
  8. // 功能描述:均价监控frame
  9. #import "AveragePriceMonitorFrame.h"
  10. #import "NSString+Tools.h"
  11. #define kTextFont [UIFont systemFontOfSize:13]
  12. @implementation AveragePriceMonitorFrame
  13. #pragma 私有函数
  14. /**
  15. 设置均价监控frame
  16. @param monitorModel <#monitorModel description#>
  17. */
  18. -(void)setAveragePriceMonitorFrame:(AveragePriceMonitorModel *)monitorModel{
  19. _averagePriceModel=monitorModel;
  20. CGFloat padding =5;
  21. CGFloat xpadding =20;
  22. CGFloat ypadding =15;
  23. NSDictionary *monitorDict = @{NSFontAttributeName:kTextFont};
  24. NSString *departmentTitleName = @"业务部门:";
  25. CGRect departmentTitleFrame = [departmentTitleName textRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) attributes:monitorDict];
  26. departmentTitleFrame.origin.x =xpadding;
  27. departmentTitleFrame.origin.y = ypadding;
  28. _departmentTitleF = departmentTitleFrame;
  29. if(_averagePriceModel.departmentName != nil){
  30. _departmentF=CGRectMake(CGRectGetMaxX(_departmentTitleF)+8, ypadding, Screen_Width/2-CGRectGetMaxX(_departmentTitleF)-8-3, 16);
  31. }
  32. NSString *kindTitleName = @"商品种类:";
  33. CGRect kindTitleFrame = [kindTitleName textRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) attributes:monitorDict];
  34. kindTitleFrame.origin.x=Screen_Width/2;
  35. kindTitleFrame.origin.y = ypadding;
  36. _kindTitleF = kindTitleFrame;
  37. if(_averagePriceModel.kindName != nil){
  38. CGRect kindNameFrame = CGRectMake(CGRectGetMaxX(_kindTitleF)+8, ypadding,Screen_Width-CGRectGetMaxX(_kindTitleF)-10, 16);
  39. _kindF = kindNameFrame;
  40. }
  41. _topSeparatorF=CGRectMake(0, CGRectGetMaxY(_departmentTitleF)+ypadding,Screen_Width, 1);
  42. NSString *profitTitleName = @"毛 利 率:";
  43. CGRect profitTitleFrame = [profitTitleName textRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) attributes:monitorDict];
  44. profitTitleFrame.origin.x=xpadding;
  45. profitTitleFrame.origin.y =CGRectGetMaxY(_topSeparatorF)+ypadding;
  46. _profitTitleF = profitTitleFrame;
  47. if(_averagePriceModel.profit != nil){
  48. CGRect profitFrame = [_averagePriceModel.profit textRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) attributes:monitorDict];
  49. profitFrame.origin.x =CGRectGetMaxX(_profitTitleF)+8;
  50. profitFrame.origin.y = CGRectGetMaxY(_topSeparatorF)+ypadding;
  51. _profitF = profitFrame;
  52. }
  53. NSString *orderQuantityTitleName = @"订单数量:";
  54. CGRect orderQuantityTitleFrame = [orderQuantityTitleName textRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) attributes:monitorDict];
  55. orderQuantityTitleFrame.origin.x=Screen_Width/2;
  56. orderQuantityTitleFrame.origin.y =CGRectGetMaxY(_topSeparatorF)+ypadding;
  57. _orderQuantityTitleF = orderQuantityTitleFrame;
  58. if(_averagePriceModel.orderQuantity != nil){
  59. CGRect orderQuantityFrame = [_averagePriceModel.orderQuantity textRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) attributes:monitorDict];
  60. orderQuantityFrame.origin.x =CGRectGetMaxX(_orderQuantityTitleF)+8;
  61. orderQuantityFrame.origin.y = CGRectGetMaxY(_topSeparatorF)+ypadding;
  62. _orderQuantityF=orderQuantityFrame;
  63. }
  64. NSString *orderAmountTitleName = @"订单总额:";
  65. CGRect orderAmountTitleFrame = [orderAmountTitleName textRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) attributes:monitorDict];
  66. orderAmountTitleFrame.origin.x=xpadding;
  67. orderAmountTitleFrame.origin.y =CGRectGetMaxY(_profitTitleF)+ypadding;
  68. _orderAmountTitleF = orderAmountTitleFrame;
  69. if(_averagePriceModel.orderAmount != nil){
  70. CGRect orderAmountFrame = [_averagePriceModel.orderAmount textRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) attributes:monitorDict];
  71. orderAmountFrame.origin.x =CGRectGetMaxX(_orderAmountTitleF)+8;
  72. orderAmountFrame.origin.y = CGRectGetMaxY(_profitTitleF)+ypadding;
  73. _orderAmountF = orderAmountFrame;
  74. }
  75. NSString *orderAveragePriceTitleName = @"订单均价:";
  76. CGRect orderAveragePriceTitleFrame = [orderAveragePriceTitleName textRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) attributes:monitorDict];
  77. orderAveragePriceTitleFrame.origin.x=Screen_Width/2;
  78. orderAveragePriceTitleFrame.origin.y =CGRectGetMaxY(_profitTitleF)+ypadding;
  79. _orderAveragePriceTitleF = orderAveragePriceTitleFrame;
  80. if(_averagePriceModel.orderAveragePrice != nil){
  81. CGRect orderAveragePriceFrame = [_averagePriceModel.orderAveragePrice textRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) attributes:monitorDict];
  82. orderAveragePriceFrame.origin.x =CGRectGetMaxX(_orderAveragePriceTitleF)+8;
  83. orderAveragePriceFrame.origin.y = CGRectGetMaxY(_profitTitleF)+ypadding;
  84. _orderAveragePriceF = orderAveragePriceFrame;
  85. }
  86. NSString *costAmountTitleName = @"成本总额:";
  87. CGRect costAmountTitleFrame = [costAmountTitleName textRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) attributes:monitorDict];
  88. costAmountTitleFrame.origin.x=xpadding;
  89. costAmountTitleFrame.origin.y =CGRectGetMaxY(_orderAmountTitleF)+ypadding;
  90. _costAmountTitleF = costAmountTitleFrame;
  91. if(_averagePriceModel.costAmount != nil){
  92. CGRect costAmountFrame = [_averagePriceModel.costAmount textRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) attributes:monitorDict];
  93. costAmountFrame.origin.x =CGRectGetMaxX(_costAmountTitleF)+8;
  94. costAmountFrame.origin.y = CGRectGetMaxY(_orderAmountTitleF)+ypadding;
  95. _costAmountF = costAmountFrame;
  96. }
  97. NSString *costAveragePriceTitleName = @"成本均价:";
  98. CGRect costAveragePriceTitleFrame = [costAveragePriceTitleName textRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) attributes:monitorDict];
  99. costAveragePriceTitleFrame.origin.x=Screen_Width/2;
  100. costAveragePriceTitleFrame.origin.y =CGRectGetMaxY(_orderAmountTitleF)+ypadding;
  101. _costAveragePriceTitleF = costAveragePriceTitleFrame;
  102. if(_averagePriceModel.costAveragePrice != nil){
  103. CGRect costAveragePriceFrame = [_averagePriceModel.costAveragePrice textRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) attributes:monitorDict];
  104. costAveragePriceFrame.origin.x =CGRectGetMaxX(_costAveragePriceTitleF)+8;
  105. costAveragePriceFrame.origin.y = CGRectGetMaxY(_orderAmountTitleF)+ypadding;
  106. _costAveragePriceF = costAveragePriceFrame;
  107. }
  108. _bottomSeparatorF=CGRectMake(0, CGRectGetMaxY(_costAmountTitleF)+ypadding, Screen_Width,10);
  109. _cellHeight=CGRectGetMaxY(_bottomSeparatorF);
  110. }
  111. @end