// // ZBOrderTitleView.m // ZBProject // // Created by 学丽 on 2019/3/27. // Copyright © 2019 ZB. All rights reserved. // #import "ZBOrderTitleView.h" @implementation ZBOrderTitleView -(instancetype)initWithFrame:(CGRect)frame { self=[super initWithFrame:frame]; if (self) { self.backgroundColor=[UIColor whiteColor]; self.layer.cornerRadius=6; self.userInteractionEnabled=YES; self.layer.masksToBounds=YES; UITapGestureRecognizer *gets =[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(clickLiveData)]; [self addGestureRecognizer:gets]; UILabel *orderpersonL =[[UILabel alloc]init]; orderpersonL.text=@"今日订单数"; orderpersonL.font=[UIFont systemFontOfSize:14]; orderpersonL.textColor=[UIColor YHColorWithHex:0x333333]; orderpersonL.textAlignment=NSTextAlignmentCenter; [self addSubview:orderpersonL]; [orderpersonL mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(13); make.height.mas_equalTo(20); make.centerX.mas_equalTo(self.mas_centerX).offset(-self.width/4); }]; UILabel *orderMonl =[[UILabel alloc]init]; orderMonl.text=@"今日预估(元)"; orderMonl.font=[UIFont systemFontOfSize:14]; orderMonl.textColor=[UIColor YHColorWithHex:0x333333]; orderMonl.textAlignment=NSTextAlignmentCenter; [self addSubview:orderMonl]; [orderMonl mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(13); make.height.mas_equalTo(20); make.centerX.mas_equalTo(self.mas_centerX).offset(self.width/4); }]; UIView *Linev=[[UIView alloc]initWithFrame:CGRectMake(self.width/2-1, 22, 2, 74)]; Linev.backgroundColor=[UIColor YHColorWithHex:0xF4F4F4]; [self addSubview:Linev]; [self addSubview:self.orderNum]; [self addSubview:self.orderMoney]; [self.orderNum mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.mas_equalTo(orderpersonL.mas_centerX).offset(-5); make.height.mas_equalTo(40); make.top.mas_equalTo(orderpersonL.mas_bottom).offset(21); }]; [self.orderMoney mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.mas_equalTo(orderMonl.mas_centerX).offset(-5); make.height.mas_equalTo(40); make.top.mas_equalTo(orderpersonL.mas_bottom).offset(21); }]; // UIImageView *personImgV =[[UIImageView alloc]init]; // personImgV.image=[UIImage imageNamed:@"top_shangsheng"]; // personImgV.tag=1111; // [self addSubview:personImgV]; // // UIImageView *moneyImgV =[[UIImageView alloc]init]; // moneyImgV.image=[UIImage imageNamed:@"top_shangsheng"]; // moneyImgV.tag=2111; // [self addSubview:moneyImgV]; // // [personImgV mas_makeConstraints:^(MASConstraintMaker *make) { // make.top.mas_equalTo(orderpersonL.mas_bottom).offset(36); // make.height.mas_equalTo(12); // make.left.mas_equalTo(self.orderNum.mas_right).offset(10); // make.width.mas_equalTo(3); // }]; // [moneyImgV mas_makeConstraints:^(MASConstraintMaker *make) { // make.top.mas_equalTo(orderpersonL.mas_bottom).offset(36); // make.height.mas_equalTo(12); // make.left.mas_equalTo(self.orderMoney.mas_right).offset(10); // make.width.mas_equalTo(3); // }]; // NSTimer *splashTimer = nil; // splashTimer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(anmimationView) userInfo:nil repeats:YES]; [self addSubview:self.addNumLabel]; [self.addNumLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(orderpersonL.mas_right).offset(5); make.top.mas_equalTo(orderpersonL.mas_bottom); make.height.mas_equalTo(26); }]; [self addSubview:self.changeAccordBtn]; [self.changeAccordBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.width.mas_equalTo(30); make.height.mas_equalTo(20); make.top.mas_equalTo(13); make.left.mas_equalTo(orderMonl.mas_right); }]; } return self; } -(void)anmimationView { UIImageView *personImgV=[self viewWithTag:1111]; UIImageView *moneyImgV=[self viewWithTag:2111]; [UIView animateWithDuration:0.6 animations:^{ moneyImgV.transform=CGAffineTransformMakeTranslation(0, -5); personImgV.transform=CGAffineTransformMakeTranslation(0, -5); } completion:^(BOOL finished) { [UIView animateWithDuration:0.6 animations:^{ moneyImgV.transform=CGAffineTransformIdentity; personImgV.transform=CGAffineTransformIdentity; }]; }]; } -(UILabel *)orderNum { if (!_orderNum) { _orderNum =[[UILabel alloc]init]; _orderNum.text=@"---"; _orderNum.font=[UIFont systemFontOfSize:28]; _orderNum.textColor=[UIColor YHColorWithHex:0x333333]; _orderNum.textAlignment=NSTextAlignmentCenter; } return _orderNum; } -(UILabel *)orderMoney { if (!_orderMoney) { _orderMoney =[[UILabel alloc]init]; _orderMoney.text=@"----"; _orderMoney.font=[UIFont systemFontOfSize:28]; _orderMoney.textColor=[UIColor YHColorWithHex:0x333333]; _orderMoney.textAlignment=NSTextAlignmentCenter; } return _orderMoney; } -(UILabel *)addNumLabel { if (!_addNumLabel) { _addNumLabel =[[UILabel alloc]init]; _addNumLabel.textColor=[UIColor YHColorWithHex:0xFF7D00]; _addNumLabel.font=[UIFont systemFontOfSize:19]; _addNumLabel.text=@"+0"; } return _addNumLabel; } -(UIButton *)changeAccordBtn { if (!_changeAccordBtn) { _changeAccordBtn=[[UIButton alloc]init]; NSString * isHidden =[PublicFunction GetMoneyStatus]; if (isHidden.integerValue == 0) { [_changeAccordBtn setImage:[UIImage imageNamed:@"xianshi_money"] forState:UIControlStateNormal]; }else{ [_changeAccordBtn setImage:[UIImage imageNamed:@"hidden_money"] forState:UIControlStateNormal]; } [_changeAccordBtn addTarget:self action:@selector(changeClickAccordBtn) forControlEvents:UIControlEventTouchUpInside]; _changeAccordBtn.adjustsImageWhenHighlighted=NO; } return _changeAccordBtn; } #pragma mark---修改,金额是否可见 -(void)changeClickAccordBtn { if (self.changeBlock) { self.changeBlock(); } } -(void)clickLiveData { if (self.LiveBlock) { self.LiveBlock(); } } @end