123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- //
- // LDWithdrawTextView.m
- // YouHuiProject
- //
- // Created by 小花 on 2018/7/31.
- // Copyright © 2018年 kuxuan. All rights reserved.
- //
- #import "LDWithdrawTextView.h"
- @interface LDWithdrawTextView ()
- @property (nonatomic, strong) UILabel *moneyLogo;
- @property (nonatomic, strong) UITextField *moneyField;
- @property (nonatomic, strong) UILabel *totalNum;
- @property (nonatomic, strong) UIButton *allBtn;
- @property (nonatomic, strong) UILabel *line;
- @property (nonatomic,strong)UILabel *tipeLabel;
- @end
- @implementation LDWithdrawTextView
- - (instancetype)initWithFrame:(CGRect)frame {
- self = [super initWithFrame:frame];
- if (self) {
- [self initSubViews];
- }
- return self;
- }
- - (void)initSubViews {
- [self addSubview:self.tipeLabel];
- [self addSubview:self.moneyLogo];
- [self addSubview:self.moneyField];
- [self addSubview:self.line];
- [self addSubview:self.totalNum];
- [self addSubview:self.allBtn];
-
- [self.tipeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(Fitsize(13));
- make.top.mas_equalTo(FITSIZE(15));
- make.width.mas_equalTo(FITSIZE(70));
- make.height.mas_equalTo(FITSIZE(20));
- }];
-
-
-
- [self.moneyLogo mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(Fitsize(14));
- make.top.mas_equalTo(self.tipeLabel.mas_bottom).mas_offset(FITSIZE(14));
- make.height.mas_equalTo(FITSIZE(50));
- }];
-
- [self.moneyField mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(self.moneyLogo.mas_right).mas_offset(3);
- make.bottom.mas_equalTo(self.moneyLogo.mas_bottom).mas_offset(Fitsize(2));
- make.width.mas_equalTo(Fitsize(310));
- make.height.mas_equalTo(Fitsize(65));
- }];
- [self.line mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(-Fitsize(15));
- make.left.mas_equalTo(Fitsize(15));
- make.height.mas_equalTo(0.5);
- make.top.mas_equalTo(self.moneyField.mas_bottom).mas_offset(Fitsize(1));
- }];
- [self.totalNum mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(self.moneyLogo);
- make.top.mas_equalTo(self.line.mas_bottom).mas_offset(Fitsize(9));
- make.height.mas_equalTo(Fitsize(20));
- }];
-
-
- [self.allBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(-Fitsize(14));
- make.width.mas_equalTo(Fitsize(80));
- make.height.mas_equalTo(Fitsize(20));
- make.centerY.mas_equalTo(self.totalNum.mas_centerY);
- }];
-
- }
- - (void)allWithdrawAction {
- self.moneyField.text = [NSString stringWithFormat:@"%.2f",[self.moneyStr floatValue]];
- }
- - (NSString *)getMoneyFieldText {
- return self.moneyField.text;
- }
- - (void)setMoneyStr:(NSString *)moneyStr {
- _moneyStr = moneyStr;
- CGFloat money = [moneyStr floatValue];
- self.totalNum.text = [NSString stringWithFormat:@"可提现金额¥%.2f",money];
- [self.moneyField becomeFirstResponder];
- }
- #pragma mark ----
- -(UILabel *)tipeLabel
- {
- if (!_tipeLabel) {
- _tipeLabel =[[UILabel alloc]init];
- _tipeLabel.text = @"提现金额";
- _tipeLabel.textColor = [UIColor YHColorWithHex:0x666666];
- _tipeLabel.font = [UIFont systemFontOfSize:Fitsize(15)];
- }
- return _tipeLabel;
- }
- - (UILabel *)moneyLogo {
- if (!_moneyLogo) {
- _moneyLogo = [[UILabel alloc] init];
- _moneyLogo.text = @"¥";
- _moneyLogo.textColor = [UIColor YHColorWithHex:0x333333];
- _moneyLogo.font = [UIFont systemFontOfSize:Fitsize(36)];
- }
- return _moneyLogo;
- }
- - (UITextField *)moneyField {
- if (!_moneyField) {
- _moneyField = [[UITextField alloc] init];
- _moneyField.textColor = [UIColor YHColorWithHex:0x000000];
- _moneyField.font = [UIFont systemFontOfSize:Fitsize(48)];
- _moneyField.keyboardType = UIKeyboardTypeDecimalPad;
- _moneyField.clearButtonMode = UITextFieldViewModeAlways;
- }
- return _moneyField;
- }
- - (UILabel *)line {
- if (!_line) {
- _line = [[UILabel alloc] init];
- _line.backgroundColor = [UIColor YHColorWithHex:0xE5E5E5];
- }
- return _line;
- }
- - (UILabel *)totalNum {
- if (!_totalNum) {
- _totalNum = [[UILabel alloc] init];
- _totalNum.font = [UIFont systemFontOfSize:Fitsize(14)];
- _totalNum.textColor = [UIColor YHColorWithHex:0x888888];
- CGFloat money = [self.moneyStr floatValue];
- _totalNum.text = [NSString stringWithFormat:@"可提现金额¥%.2f",money];
- }
- return _totalNum;
- }
- - (UIButton *)allBtn {
- if (!_allBtn) {
- _allBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- [_allBtn setTitle:@"全部提现" forState:UIControlStateNormal];
- [_allBtn setTitleColor:[UIColor homeRedColor] forState:UIControlStateNormal];
- _allBtn.titleLabel.font = [UIFont systemFontOfSize:Fitsize(14)];
- [_allBtn addTarget:self action:@selector(allWithdrawAction) forControlEvents:UIControlEventTouchUpInside];
- }
- return _allBtn;
- }
- @end
|