【问题标题】:Assigning multiple images to one UIImageView?将多个图像分配给一个 UIImageView?
【发布时间】: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


    【解决方案1】:

    假设每个 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"];
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-15
      • 2010-12-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多