TextBox要加倍然后显示为字符串AlertView

时间:2012-05-26 17:26:33

标签: iphone xcode

我无法在警报视图中显示双重内容。该字符串在AlertView中始终显示为0。提前谢谢!

    double binRadius = [txtRadiusInches.text doubleValue] / 12 + [txtRadiusFeet.text doubleValue];
NSString *myString = [NSString stringWithFormat:@"%d", binRadius];

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Estimatated Amount"
                                                message:myString
                                               delegate:self
                                      cancelButtonTitle:@"Continue"
                                      otherButtonTitles:@"Clear All", nil];

[alert show];

1 个答案:

答案 0 :(得分:1)

%d(和%i)是整数的格式说明符(小数)。对于浮点数,您应该使用%f