123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- //
- // DRMineBlanceView.m
- // YouHuiProject
- //
- // Created by 小花 on 2018/5/17.
- // Copyright © 2018年 kuxuan. All rights reserved.
- //
- #import "DRMineBlanceView.h"
- @interface DRMineBlanceView()
- @property (nonatomic, strong) UILabel *priceLabel;
- @property (nonatomic, strong) UILabel *todayMoneyLabel;
- @property (nonatomic, strong) UIImageView *rightArrow;//
- @end
- @implementation DRMineBlanceView
- - (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, 0, 60, 30)];
- 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, 30)];
- 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);
- }];
-
- }
- @end
|