|
@@ -9,6 +9,7 @@
|
|
|
{
|
|
|
UIView *bgView;/*引导视图*/
|
|
|
}
|
|
|
+@property(nonatomic,copy)NSMutableString *curKeyToForgetPwd;//特殊符号进入忘记密码
|
|
|
@end
|
|
|
|
|
|
@implementation CalculatorViewController
|
|
@@ -36,6 +37,8 @@
|
|
|
}
|
|
|
|
|
|
[[connectDeviceManager shareInstance] RefreshThridMsg];
|
|
|
+
|
|
|
+ _curKeyToForgetPwd = [NSMutableString new];
|
|
|
}
|
|
|
|
|
|
- (void)addGuideView{
|
|
@@ -205,10 +208,13 @@
|
|
|
self.TF.text=@"0";
|
|
|
[sender setTitle:@"AC" forState:UIControlStateNormal];
|
|
|
[self.cl calculatorEmpty];
|
|
|
+
|
|
|
+ _curKeyToForgetPwd = [NSMutableString new];
|
|
|
break;
|
|
|
case 101:
|
|
|
//正负转换
|
|
|
[self getPlusMinus:self.TF.text];
|
|
|
+ _curKeyToForgetPwd = [NSMutableString new];
|
|
|
break;
|
|
|
case 102:
|
|
|
//百分比
|
|
@@ -221,6 +227,7 @@
|
|
|
self.cl.exType=1;
|
|
|
[self buttonSymbolStyleReduction:sender];
|
|
|
[self buttonSymbolStyle:sender];
|
|
|
+ _curKeyToForgetPwd = [NSMutableString new];
|
|
|
break;
|
|
|
case 107:
|
|
|
//乘
|
|
@@ -229,6 +236,7 @@
|
|
|
self.cl.exType=2;
|
|
|
[self buttonSymbolStyleReduction:sender];
|
|
|
[self buttonSymbolStyle:sender];
|
|
|
+ _curKeyToForgetPwd = [NSMutableString new];
|
|
|
break;
|
|
|
case 111:
|
|
|
//减
|
|
@@ -237,6 +245,7 @@
|
|
|
self.cl.exType=3;
|
|
|
[self buttonSymbolStyleReduction:sender];
|
|
|
[self buttonSymbolStyle:sender];
|
|
|
+ _curKeyToForgetPwd = [NSMutableString new];
|
|
|
break;
|
|
|
case 115:
|
|
|
//加
|
|
@@ -245,13 +254,16 @@
|
|
|
self.cl.exType=4;
|
|
|
[self buttonSymbolStyleReduction:sender];
|
|
|
[self buttonSymbolStyle:sender];
|
|
|
+ _curKeyToForgetPwd = [NSMutableString new];
|
|
|
break;
|
|
|
case 117:
|
|
|
//小数点
|
|
|
[self decimalPoint:self.TF Button:sender];
|
|
|
+ _curKeyToForgetPwd = [NSMutableString new];
|
|
|
break;
|
|
|
case 118:
|
|
|
//等
|
|
|
+ [self didClickEqualbuttonFun];
|
|
|
[self execute];
|
|
|
self.cl.exType=0;
|
|
|
[self buttonSymbolStyleReduction:sender];
|
|
@@ -266,10 +278,15 @@
|
|
|
[self buttonSymbolStyleReduction:sender];
|
|
|
[(UIButton *)[self.view viewWithTag:100] setTitle:@"C" forState:UIControlStateNormal];
|
|
|
[self textFieldValueChange:self.TF Button:sender];
|
|
|
+
|
|
|
+ _curKeyToForgetPwd = [NSMutableString new];
|
|
|
+
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
[self addTextFieldFormat];
|
|
|
+
|
|
|
+ HLog(@"忘记密码:%@",_curKeyToForgetPwd);
|
|
|
}
|
|
|
|
|
|
#pragma mark ----样式处理----
|
|
@@ -488,6 +505,18 @@
|
|
|
//计算百分比
|
|
|
-(void)getPercentage:(NSString *)number{
|
|
|
|
|
|
+ //记录特殊情况--忘记密码输入
|
|
|
+ if(!number || number.intValue == 0){
|
|
|
+ if(!_curKeyToForgetPwd || _curKeyToForgetPwd.length == 0){
|
|
|
+ _curKeyToForgetPwd = [[NSMutableString alloc] initWithFormat:@"%@",@"%"];
|
|
|
+ //HLog(@"11:%@",_curKeyToForgetPwd);
|
|
|
+ }
|
|
|
+ else if(_curKeyToForgetPwd.length == 3){
|
|
|
+ [_curKeyToForgetPwd appendString:@"%"];
|
|
|
+ [self checkOrderToForgetPwdFun];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
number=[NSString stringWithFormat:@"%f",[number doubleValue]/100];
|
|
|
//去除floa转换后后面多余的0
|
|
|
self.TF.text = [NSString stringFloatHandle:number];
|
|
@@ -532,4 +561,31 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+#pragma mark 按=号
|
|
|
+- (void)didClickEqualbuttonFun
|
|
|
+{
|
|
|
+ //记录特殊情况--忘记密码输入
|
|
|
+ //HLog(@"22:%@",self.TF.text)
|
|
|
+ if(!self.TF.text
|
|
|
+ || self.TF.text.length == 0
|
|
|
+ || [self.TF.text isEqualToString:@"0"]){
|
|
|
+ if(_curKeyToForgetPwd
|
|
|
+ && _curKeyToForgetPwd.length >=1
|
|
|
+ && [keyToForgetPwd rangeOfString:_curKeyToForgetPwd].location != NSNotFound
|
|
|
+ ){
|
|
|
+ [_curKeyToForgetPwd appendString:@"="];
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark 验证是否为忘记密码指令
|
|
|
+- (void)checkOrderToForgetPwdFun
|
|
|
+{
|
|
|
+ if([_curKeyToForgetPwd isEqualToString:keyToForgetPwd]){
|
|
|
+ [[NSNotificationCenter defaultCenter] postNotificationName:forgetPwdNotification object:nil];
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ _curKeyToForgetPwd = [NSMutableString new];
|
|
|
+ }
|
|
|
+}
|
|
|
@end
|