您好我正在尝试添加(数学不能将字母放在一起)文本字段的数据和标签的数据。我已经执行了下面看到的用于乘法的相同代码,但是当我做同样的事情(稍微改变)时,它似乎不起作用。我下面的代码只显示了billAmountTextField的值。你知道为什么吗?谢谢你的帮助!
-(IBAction)totalAllUp:(id)sender
{
NSString *billTotalAmountString = [billAmountTextField text];
float billTotalFloat =[billTotalAmountString floatValue];
NSString *tipTotalAmountString = [resultLabel text];
float tipTotalAmountFloat = [tipTotalAmountString floatValue];
float totalAmountAfterAdding = billTotalFloat + tipTotalAmountFloat;
NSString *finalAnswer = [NSString stringWithFormat:@"%0.2f", totalAmountAfterAdding];
[totalAfterAdd setText:finalAnswer];
}