我无法在警报视图中显示双重内容。该字符串在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];
答案 0 :(得分:1)
%d
(和%i
)是整数的格式说明符(小数)。对于浮点数,您应该使用%f
。