12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- //
- // KBMineBlanceView.m
- // YouHuiProject
- //
- // Created by 小花 on 2018/5/17.
- // Copyright © 2018年 kuxuan. All rights reserved.
- //
- #import "KBMineBlanceView.h"
- @interface KBMineBlanceView()
- @property (nonatomic, strong) UILabel *priceLabel;
- @end
- @implementation KBMineBlanceView
- - (instancetype)initWithFrame:(CGRect)frame {
- self = [super initWithFrame:frame];
- if (self) {
- self.backgroundColor = [UIColor whiteColor];
- self.layer.cornerRadius = 6;
- self.layer.masksToBounds = YES;
- [self initSubViews];
- }
- return self;
- }
- -(void)moneyAction{
- if (self.moneyBlock) {
- self.moneyBlock();
- }
-
- }
- - (void)setBlancePrice:(NSString *)blance {
- self.priceLabel.text = [NSString stringWithFormat:@"¥%@",blance];
- }
- - (void)initSubViews {
- 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];
-
- UIButton *moneyBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.width-17-44, 0, 44, 20)];
- moneyBtn.layer.borderWidth = 1;
- moneyBtn.layer.borderColor = [UIColor homeRedColor].CGColor;
- moneyBtn.layer.cornerRadius = 10;
- moneyBtn.centerY = self.priceLabel.centerY;
- moneyBtn.titleLabel.font = [UIFont systemFontOfSize:10];
- [moneyBtn setTitleColor:[UIColor homeRedColor] forState:UIControlStateNormal];
- [moneyBtn setTitle:@"提现" forState:UIControlStateNormal];
- [moneyBtn addTarget:self action:@selector(moneyAction) forControlEvents:UIControlEventTouchUpInside];
- [self addSubview:moneyBtn];
-
- }
- @end
|