Skip to content

检查TextField中数字的合法性时 若修改值 调协议方法 #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion PPNumberButton/PPNumberButton/PPNumberButton.m
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,16 @@ - (void)checkTextFieldNumberWithUpdate
}else{
_textField.text = _decreaseHide ? [NSString stringWithFormat:@"%.f",minValueString.floatValue-self.stepValue]:minValueString;
}
if ([_delegate respondsToSelector:@selector(pp_numberButton: number: increaseStatus:)]) {
[_delegate pp_numberButton:self number:_textField.text.floatValue increaseStatus:NO];
}
}
if ([_textField.text floatValue] > _maxValue) {
_textField.text = maxValueString;
if ([_delegate respondsToSelector:@selector(pp_numberButton: number: increaseStatus:)]) {
[_delegate pp_numberButton:self number:_textField.text.floatValue increaseStatus:YES];
}
}
[_textField.text floatValue] > _maxValue ? _textField.text = maxValueString : nil;
}

/// 清除定时器
Expand Down