Iphone 文本框加倍,然后显示为字符串AlertView
我很难让替身出现在我的警戒视图中。该字符串在AlertView中始终显示为0。提前谢谢Iphone 文本框加倍,然后显示为字符串AlertView,iphone,xcode,Iphone,Xcode,我很难让替身出现在我的警戒视图中。该字符串在AlertView中始终显示为0。提前谢谢 double binRadius = [txtRadiusInches.text doubleValue] / 12 + [txtRadiusFeet.text doubleValue]; NSString *myString = [NSString stringWithFormat:@"%d", binRadius]; UIAlertView *alert = [[UIAlertView allo
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];
%d
(和%i
)是整数(小数)的格式说明符。对于浮点数,您应该使用%f
谢谢,这解决了问题。