当他们在我的应用程序中点击计算按钮时,我正在执行以下代码:
float sqft = ([textfield1.text floatValue]);
float thick= ([textfield2.text floatValue]);
float cos = ([textfield3.text floatValue]);
float eff = ([textfield4.text floatValue]);
float num = ((thick*.5)*sqft)/eff;
float cost = (num*cos);
float costft = (cost/sqft);
label1.text = [NSString stringWithFormat:@"%2.f",num];
label2.text = [NSString stringWithFormat:@"%2.f",cost];
label3.text = [NSString stringWithFormat:@"%2.f",costft];
当我这样做时,标签只返回零。我已将标签设置为字符串,只是为了看看它是否是一个委托,但我不知道为什么我的公式只返回零