你好。我正在尝试创建一个计算器,当我尝试使用 point 时它不起作用。当我单击点按钮时,所有其他数字都会被删除,并且点会停留在开头。
- (IBAction)buttonPoint:(id)sender {
if (self.statusMode == false) {
winMargin.text = [winMargin.text stringByAppendingString:@"."];
winMarginString = winMargin.text;
winMarginInt = [winMarginString doubleValue];
NSLog(@"%@", winMargin.text); // .
NSLog(@"%.20f", winMarginInt); // Gives back 0.00000000000000000000
}
}
- (IBAction)buttonOne:(id)sender {
if (self.statusMode == false) {
winMargin.text = [winMargin.text stringByAppendingString:@"1"];
winMarginString = winMargin.text;
winMarginInt = [winMarginString doubleValue];
NSLog(@"%@", winMargin.text);
NSLog(@"%.20f", winMarginInt);
}
}