修复bug

This commit is contained in:
liyuhua
2023-09-20 18:51:57 +08:00
parent 0188a148b2
commit 3cce473244
2 changed files with 26 additions and 0 deletions

View File

@@ -114,12 +114,22 @@
textField.text = @"1";
}
self.chooseNum = textField.text;
NSArray *btnArr = @[self.oneTapBtn,self.tenTapBtn,self.hundredTapBtn];
for (UIButton *btn in btnArr) {
btn.backgroundColor = [UIColor clearColor];
[btn setTitleColor:[UIColor colorWithWhite:1 alpha:0.6] forState:UIControlStateNormal];
}
}
- (void)textFieldDidEndEditing:(UITextField *)textField{
if(textField.text.length <= 1){
textField.text = @"1";
}
self.chooseNum = textField.text;
NSArray *btnArr = @[self.oneTapBtn,self.tenTapBtn,self.hundredTapBtn];
for (UIButton *btn in btnArr) {
btn.backgroundColor = [UIColor clearColor];
[btn setTitleColor:[UIColor colorWithWhite:1 alpha:0.6] forState:UIControlStateNormal];
}
}
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
return [self validateNumber:string];
@@ -143,6 +153,7 @@
-(void)choosePurchaseNumAction:(UIButton *)sender{
self.chooseNum = sender.currentTitle;
NSArray *btnArr = @[self.oneTapBtn,self.tenTapBtn,self.hundredTapBtn];
self.textField.text = @"";
for (UIButton *btn in btnArr) {
if(btn == sender){
btn.backgroundColor = UIColorFromRGB(0x683FAD);

View File

@@ -112,6 +112,7 @@
-(void)chooseBuyNumAction:(UIButton *)sender{
UIButton *supBtn = (UIButton *)sender.superview;
self.chooseNum = supBtn.currentTitle;
self.textField.text = @"";
NSArray *btnArr = @[self.firstBg,self.tenthBg,self.hundredthBg];
for (UIButton *btn in btnArr) {
if(btn == sender){
@@ -130,11 +131,25 @@
textField.text = @"1";
}
self.chooseNum = textField.text;
NSArray *btnArr = @[self.firstBg,self.tenthBg,self.hundredthBg];
for (UIButton *btn in btnArr) {
btn.hidden = NO;
btn.superview.layer.borderWidth = 0;
}
}
- (void)textFieldDidEndEditing:(UITextField *)textField{
if(textField.text.length <= 1){
textField.text = @"1";
}
NSArray *btnArr = @[self.firstBg,self.tenthBg,self.hundredthBg];
for (UIButton *btn in btnArr) {
btn.hidden = NO;
btn.superview.layer.borderWidth = 0;
}
self.chooseNum = textField.text;
}
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {