// // LDMineBlanceView.m // YouHuiProject // // Created by 小花 on 2018/5/17. // Copyright © 2018年 kuxuan. All rights reserved. // #import "LDMineBlanceView.h" @interface LDMineBlanceView() @property (nonatomic, strong) UILabel *priceLabel; @property (nonatomic, strong) UILabel *todayMoneyLabel; @property (nonatomic, strong) UIImageView *rightArrow;// @end @implementation LDMineBlanceView - (instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { self.backgroundColor = [UIColor whiteColor]; self.layer.cornerRadius = 6; [self initSubViews]; // self.layer.shadowColor = [UIColor homeRedColor].CGColor; // self.layer.shadowOffset = CGSizeMake(0, 0); // self.layer.shadowOpacity = 0.3; // self.layer.shadowRadius = 3; } return self; } -(void)moneyAction{ if (self.moneyBlock) { self.moneyBlock(); } } -(void)setTodayMoney:(NSString *)todayMoney { _todayMoney = todayMoney; if (todayMoney.length <= 0 || [todayMoney isEqualToString:@"0.00"]) { self.todayMoneyLabel.text = @""; }else { self.todayMoneyLabel.text = [NSString stringWithFormat:@"+¥%@",todayMoney]; } } - (void)setBlancePrice:(NSString *)blance { self.priceLabel.text = [NSString stringWithFormat:@"¥%@",blance]; } - (void)initSubViews { UIView *alphaView = [[UIView alloc] initWithFrame:self.bounds]; alphaView.backgroundColor = [UIColor clearColor]; UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(moneyAction)]; [alphaView addGestureRecognizer:tap]; [self addSubview:alphaView]; UILabel *title = [[UILabel alloc] initWithFrame:CGRectMake(15, 10, 60, 20)]; // title.centerY = self.height/2; title.text = @"我的收益"; title.font = [UIFont systemFontOfSize:14]; [self addSubview:title]; self.priceLabel = [[UILabel alloc] initWithFrame:CGRectMake(title.right+21, 0, 200, 20)]; self.priceLabel.centerY = title.centerY; self.priceLabel.textColor = [UIColor homeRedColor]; self.priceLabel.text = @"-.--"; self.priceLabel.font = [UIFont systemFontOfSize:24]; [self addSubview:self.priceLabel]; self.todayMoneyLabel = [[UILabel alloc] init]; [self addSubview:self.todayMoneyLabel]; [self.todayMoneyLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(self).mas_offset(FITSIZE(-36)); make.width.mas_greaterThanOrEqualTo(FITSIZE(60)); make.height.mas_greaterThanOrEqualTo(FITSIZE(20)); make.centerY.mas_equalTo(title); }]; self.todayMoneyLabel.textColor = [UIColor homeRedColor]; self.todayMoneyLabel.font = [UIFont systemFontOfSize:14]; self.todayMoneyLabel.textAlignment = NSTextAlignmentRight; self.rightArrow = [[UIImageView alloc] init]; [self addSubview:self.rightArrow]; [self.rightArrow mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(self.todayMoneyLabel.mas_right).mas_offset(FITSIZE(11)); make.centerY.mas_equalTo(title); make.width.mas_greaterThanOrEqualTo(FITSIZE(7)); make.height.mas_greaterThanOrEqualTo(FITSIZE(11)); }]; self.rightArrow.image = [UIImage imageNamed:@"fanhui_右箭头"]; UIButton *moneyBtn = [[UIButton alloc] init]; [moneyBtn addTarget:self action:@selector(moneyAction) forControlEvents:UIControlEventTouchUpInside]; [self addSubview:moneyBtn]; [moneyBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.edges.mas_equalTo(self); }]; UILabel *tipeL =[[UILabel alloc]initWithFrame:CGRectMake(title.left, title.bottom+10, 150, 16)]; tipeL.text=@"每月25号可提现上月结算收益"; tipeL.textColor=[UIColor YHColorWithHex:0x999999]; tipeL.font=[UIFont systemFontOfSize:11]; [self addSubview:tipeL]; } @end