// // KDPEarningHeadView.m // KuDianProject // // Created by 学丽 on 2019/7/4. // Copyright © 2019 KDP. All rights reserved. // #import "KDPEarningHeadView.h" @implementation KDPEarningHeadView -(instancetype)initWithFrame:(CGRect)frame { self=[super initWithFrame:frame]; if (self) { [self initEarnUI]; } return self; } -(void)initEarnUI { UIImageView *backImgV=[[UIImageView alloc]init]; backImgV.image=[UIImage imageNamed:@"mine_back_icon"]; [self addSubview:backImgV]; [backImgV mas_makeConstraints:^(MASConstraintMaker *make) { make.left.top.right.bottom.mas_equalTo(0); ; }]; [UIApplication sharedApplication].statusBarStyle=UIStatusBarStyleLightContent; [backImgV addSubview:self.headImgBtn]; [self.headImgBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(10); make.top.mas_equalTo(KDStatusHeight+4); make.height.width.mas_equalTo(32); }]; UIImageView *imgv=[[UIImageView alloc]initWithFrame:CGRectMake(2, 2, 28, 28)]; imgv.layer.cornerRadius=14; imgv.layer.masksToBounds=YES; KDPAccountModel *model=[KDPAccountTool account]; [imgv sd_setImageWithURL:[NSURL URLWithString:model.img]placeholderImage:[UIImage imageNamed:placholderImg]]; [self.headImgBtn addSubview:imgv]; UIImageView *imgV=[[UIImageView alloc]init]; imgV.image=[UIImage imageNamed:@"LIVE"]; [backImgV addSubview:imgV]; [imgV mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(self.headImgBtn.mas_left).offset(5); make.width.mas_equalTo(22); make.height.mas_equalTo(9); make.top.mas_equalTo(self.headImgBtn.mas_bottom).offset(-7); }]; UILabel *titleL =[[UILabel alloc]initWithFrame:CGRectMake(50, KDStatusHeight, SCREEN_WIDTH-100, 44)]; titleL.textAlignment=NSTextAlignmentCenter; titleL.text=@"我的收益"; titleL.font=[UIFont systemFontOfSize:17]; titleL.textColor=[UIColor whiteColor]; [backImgV addSubview:titleL]; backImgV.userInteractionEnabled=YES; [backImgV addSubview:self.orderNumgL]; [backImgV addSubview:self.Forecastlabel]; [self.orderNumgL mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(0); make.top.mas_equalTo(KDStatusHeight+66); make.height.mas_equalTo(42); make.width.mas_equalTo(SCREEN_WIDTH/2); }]; [self.Forecastlabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(self.orderNumgL.mas_right); make.top.mas_equalTo(KDStatusHeight+66); make.height.mas_equalTo(42); make.width.mas_equalTo(SCREEN_WIDTH/2); }]; UILabel *ordertitleL=[[UILabel alloc]init]; ordertitleL.text=@"预估订单量"; ordertitleL.font=[UIFont systemFontOfSize:12]; ordertitleL.textColor=[UIColor whiteColor]; ordertitleL.textAlignment=NSTextAlignmentCenter; [backImgV addSubview:ordertitleL]; [ordertitleL mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(0); make.top.mas_equalTo(self.orderNumgL.mas_bottom).offset(6); make.height.mas_equalTo(17); make.width.mas_equalTo(SCREEN_WIDTH/2); }]; UILabel *eariLabel=[[UILabel alloc]init]; eariLabel.text=@"预估收益>"; UITapGestureRecognizer *getst=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(clickIncomeforeCast)]; eariLabel.userInteractionEnabled=YES; [eariLabel addGestureRecognizer:getst]; eariLabel.font=[UIFont systemFontOfSize:12]; eariLabel.textColor=[UIColor whiteColor]; eariLabel.textAlignment=NSTextAlignmentCenter; [backImgV addSubview:eariLabel]; [eariLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(self.Forecastlabel.mas_left); make.top.mas_equalTo(self.Forecastlabel.mas_bottom).offset(6); make.height.mas_equalTo(17); make.width.mas_equalTo(SCREEN_WIDTH/2); }]; } #pragma mark---预估收益 -(void)clickIncomeforeCast{ if (self.forecastBlock) { self.forecastBlock(); } } #pragma mark---页面布局 -(UIButton *)headImgBtn { if (!_headImgBtn) { _headImgBtn=[[UIButton alloc]init]; _headImgBtn.backgroundColor=[UIColor colorWithHexString:ThemeColor]; _headImgBtn.layer.cornerRadius=16; _headImgBtn.layer.masksToBounds=YES; _headImgBtn.layer.borderColor=[UIColor colorWithHexString:@"#FFB444"].CGColor; _headImgBtn.layer.borderWidth=1; [_headImgBtn addTarget:self action:@selector(drawerClickButton) forControlEvents:UIControlEventTouchUpInside]; _headImgBtn.adjustsImageWhenHighlighted=NO; } return _headImgBtn; } -(UIButton *)todayButton { if (!_todayButton) { _todayButton=[[UIButton alloc]init]; [_todayButton setImage:[UIImage imageNamed:@"today_icon"] forState:UIControlStateNormal]; _todayButton.adjustsImageWhenHighlighted=NO; [_todayButton addTarget:self action:@selector(todayclickButton) forControlEvents:UIControlEventTouchUpInside]; } return _todayButton; } -(UILabel *)orderNumgL { if (!_orderNumgL) { _orderNumgL=[[UILabel alloc]init]; _orderNumgL.text=@"----"; _orderNumgL.font=[UIFont boldSystemFontOfSize:30]; _orderNumgL.textColor=[UIColor whiteColor]; _orderNumgL.textAlignment=NSTextAlignmentCenter; } return _orderNumgL; } -(UILabel *)Forecastlabel { if (!_Forecastlabel) { _Forecastlabel=[[UILabel alloc]init]; _Forecastlabel.text=@"----"; _Forecastlabel.font=[UIFont boldSystemFontOfSize:30]; _Forecastlabel.textColor=[UIColor whiteColor]; _Forecastlabel.textAlignment=NSTextAlignmentCenter; } return _Forecastlabel; } #pragma mark---侧滑 -(void)drawerClickButton { if (self.drawcBlock) { self.drawcBlock(); } } #pragma mark---消息中心 -(void)todayclickButton { } @end