Skip to content
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

Fix bug when user first press the decimalSeparator #33

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
Fix bug when user first press the decimalSeparator
jberlana committed Feb 3, 2016

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 40e12b2356b0170f1806504b2c3411048c93f6d1
3 changes: 3 additions & 0 deletions VENCalculatorInputView/VENCalculatorInputTextField.m
Original file line number Diff line number Diff line change
@@ -80,6 +80,9 @@ - (void)calculatorInputView:(VENCalculatorInputView *)inputView didTapKey:(NSStr
self.text = subString;
}
} else if ([key isEqualToString:[self decimalSeparator]]) {
if (self.text.length == 1) {
self.text = [NSString stringWithFormat:@"0%@",[self decimalSeparator]];
}
NSString *secondToLastCharacterString = [self.text substringWithRange:NSMakeRange([self.text length] - 2, 1)];
if ([secondToLastCharacterString isEqualToString:[self decimalSeparator]]) {
self.text = subString;