【发布时间】:2013-07-25 04:00:52
【问题描述】:
在我的应用程序中,如果用户计算出的 BMI
例如,如果用户的 BMI
我上面解释的标签代码是:
if ([bmiView.text floatValue] < 18.50) {
classification.text = @"Underweight";
// Desired code to go here
}
【问题讨论】:
标签: uiimageview variable-assignment
在我的应用程序中,如果用户计算出的 BMI
例如,如果用户的 BMI
我上面解释的标签代码是:
if ([bmiView.text floatValue] < 18.50) {
classification.text = @"Underweight";
// Desired code to go here
}
【问题讨论】:
标签: uiimageview variable-assignment
假设每个 BMI 有三个图像,并且您的 imageview 称为 bmiImageView,为什么不通过编程计算 BMI 时分配图像。
if ([bmiView.text floatValue] < 18.50) {
classification.text = @"Underweight";
bmiImageView.image = [UIImage imageNamed:@"Underweight.png"];
} else if ([bmiView.text floatValue] == 18.50) {
classification.text = @"Perfect Weight";
bmiImageView.image = [UIImage imageNamed:@"perfectweight.png"];
} else if ([bmiView.text floatValue] > 18.50) {
classification.text = @"Overweight";
bmiImageView.image = [UIImage imageNamed:@"overweight.png"];
}
【讨论】: