123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194 |
- //
- // 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
|