| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- //
- // AveragePriceMonitorModel.m
- // IBOSS
- //
- // Created by guan hong hou on 2017/9/8.
- // Copyright © 2017年 elongtian. All rights reserved.
- //
- // 功能描述:均价监控frame
- #import "AveragePriceMonitorFrame.h"
- #import "NSString+Tools.h"
- #define kTextFont [UIFont systemFontOfSize:13]
- @implementation AveragePriceMonitorFrame
- #pragma 私有函数
- /**
- 设置均价监控frame
- @param monitorModel <#monitorModel description#>
- */
- -(void)setAveragePriceMonitorFrame:(AveragePriceMonitorModel *)monitorModel{
- _averagePriceModel=monitorModel;
- CGFloat padding =5;
- CGFloat xpadding =20;
- CGFloat ypadding =15;
- NSDictionary *monitorDict = @{NSFontAttributeName:kTextFont};
- NSString *departmentTitleName = @"业务部门:";
- CGRect departmentTitleFrame = [departmentTitleName textRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) attributes:monitorDict];
- departmentTitleFrame.origin.x =xpadding;
- departmentTitleFrame.origin.y = ypadding;
- _departmentTitleF = departmentTitleFrame;
-
- if(_averagePriceModel.departmentName != nil){
- _departmentF=CGRectMake(CGRectGetMaxX(_departmentTitleF)+8, ypadding, Screen_Width/2-CGRectGetMaxX(_departmentTitleF)-8-3, 16);
- }
-
- NSString *kindTitleName = @"商品种类:";
- CGRect kindTitleFrame = [kindTitleName textRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) attributes:monitorDict];
- kindTitleFrame.origin.x=Screen_Width/2;
- kindTitleFrame.origin.y = ypadding;
- _kindTitleF = kindTitleFrame;
- if(_averagePriceModel.kindName != nil){
- CGRect kindNameFrame = CGRectMake(CGRectGetMaxX(_kindTitleF)+8, ypadding,Screen_Width-CGRectGetMaxX(_kindTitleF)-10, 16);
-
- _kindF = kindNameFrame;
- }
-
- _topSeparatorF=CGRectMake(0, CGRectGetMaxY(_departmentTitleF)+ypadding,Screen_Width, 1);
-
- NSString *profitTitleName = @"毛 利 率:";
- CGRect profitTitleFrame = [profitTitleName textRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) attributes:monitorDict];
- profitTitleFrame.origin.x=xpadding;
- profitTitleFrame.origin.y =CGRectGetMaxY(_topSeparatorF)+ypadding;
- _profitTitleF = profitTitleFrame;
- if(_averagePriceModel.profit != nil){
- CGRect profitFrame = [_averagePriceModel.profit textRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) attributes:monitorDict];
-
- profitFrame.origin.x =CGRectGetMaxX(_profitTitleF)+8;
- profitFrame.origin.y = CGRectGetMaxY(_topSeparatorF)+ypadding;
- _profitF = profitFrame;
- }
-
- NSString *orderQuantityTitleName = @"订单数量:";
- CGRect orderQuantityTitleFrame = [orderQuantityTitleName textRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) attributes:monitorDict];
- orderQuantityTitleFrame.origin.x=Screen_Width/2;
- orderQuantityTitleFrame.origin.y =CGRectGetMaxY(_topSeparatorF)+ypadding;
- _orderQuantityTitleF = orderQuantityTitleFrame;
- if(_averagePriceModel.orderQuantity != nil){
- CGRect orderQuantityFrame = [_averagePriceModel.orderQuantity textRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) attributes:monitorDict];
-
- orderQuantityFrame.origin.x =CGRectGetMaxX(_orderQuantityTitleF)+8;
- orderQuantityFrame.origin.y = CGRectGetMaxY(_topSeparatorF)+ypadding;
- _orderQuantityF=orderQuantityFrame;
- }
-
- NSString *orderAmountTitleName = @"订单总额:";
- CGRect orderAmountTitleFrame = [orderAmountTitleName textRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) attributes:monitorDict];
- orderAmountTitleFrame.origin.x=xpadding;
- orderAmountTitleFrame.origin.y =CGRectGetMaxY(_profitTitleF)+ypadding;
- _orderAmountTitleF = orderAmountTitleFrame;
- if(_averagePriceModel.orderAmount != nil){
- CGRect orderAmountFrame = [_averagePriceModel.orderAmount textRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) attributes:monitorDict];
-
- orderAmountFrame.origin.x =CGRectGetMaxX(_orderAmountTitleF)+8;
- orderAmountFrame.origin.y = CGRectGetMaxY(_profitTitleF)+ypadding;
- _orderAmountF = orderAmountFrame;
- }
-
- NSString *orderAveragePriceTitleName = @"订单均价:";
- CGRect orderAveragePriceTitleFrame = [orderAveragePriceTitleName textRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) attributes:monitorDict];
- orderAveragePriceTitleFrame.origin.x=Screen_Width/2;
- orderAveragePriceTitleFrame.origin.y =CGRectGetMaxY(_profitTitleF)+ypadding;
- _orderAveragePriceTitleF = orderAveragePriceTitleFrame;
-
- if(_averagePriceModel.orderAveragePrice != nil){
- CGRect orderAveragePriceFrame = [_averagePriceModel.orderAveragePrice textRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) attributes:monitorDict];
-
- orderAveragePriceFrame.origin.x =CGRectGetMaxX(_orderAveragePriceTitleF)+8;
- orderAveragePriceFrame.origin.y = CGRectGetMaxY(_profitTitleF)+ypadding;
- _orderAveragePriceF = orderAveragePriceFrame;
- }
-
- NSString *costAmountTitleName = @"成本总额:";
- CGRect costAmountTitleFrame = [costAmountTitleName textRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) attributes:monitorDict];
-
- costAmountTitleFrame.origin.x=xpadding;
- costAmountTitleFrame.origin.y =CGRectGetMaxY(_orderAmountTitleF)+ypadding;
- _costAmountTitleF = costAmountTitleFrame;
- if(_averagePriceModel.costAmount != nil){
- CGRect costAmountFrame = [_averagePriceModel.costAmount textRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) attributes:monitorDict];
-
- costAmountFrame.origin.x =CGRectGetMaxX(_costAmountTitleF)+8;
- costAmountFrame.origin.y = CGRectGetMaxY(_orderAmountTitleF)+ypadding;
- _costAmountF = costAmountFrame;
- }
-
- NSString *costAveragePriceTitleName = @"成本均价:";
- CGRect costAveragePriceTitleFrame = [costAveragePriceTitleName textRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) attributes:monitorDict];
-
- costAveragePriceTitleFrame.origin.x=Screen_Width/2;
- costAveragePriceTitleFrame.origin.y =CGRectGetMaxY(_orderAmountTitleF)+ypadding;
- _costAveragePriceTitleF = costAveragePriceTitleFrame;
- if(_averagePriceModel.costAveragePrice != nil){
- CGRect costAveragePriceFrame = [_averagePriceModel.costAveragePrice textRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) attributes:monitorDict];
-
- costAveragePriceFrame.origin.x =CGRectGetMaxX(_costAveragePriceTitleF)+8;
- costAveragePriceFrame.origin.y = CGRectGetMaxY(_orderAmountTitleF)+ypadding;
- _costAveragePriceF = costAveragePriceFrame;
- }
- _bottomSeparatorF=CGRectMake(0, CGRectGetMaxY(_costAmountTitleF)+ypadding, Screen_Width,10);
- _cellHeight=CGRectGetMaxY(_bottomSeparatorF);
-
- }
- @end
|