ios - how to replace an image on an image view when score changes? -
i have 2 images 1 gold 1 green,
when score 100 image must gold image if score goes below 100 points image must change green image.
} if (score < 100) { closeonechange.text = @"correct!"; } else { closeonechange.text = @"perfect!"; }
the green image called greenone.png
how done?
if have 2 uiimageview
s can use hidden
property hide/show them required:
if (score < 100) { closeonechange.text = @"correct!"; imageview1.hidden = no; imageview2.hidden = yes; } else { closeonechange.text = @"perfect!"; imageview1.hidden = yes; imageview2.hidden = no; }
if have single uiimageview
, can change image on fly:
if (score < 100) { closeonechange.text = @"correct!"; imageview.image = [uiimage imagenamed:@"correct"]; } else { closeonechange.text = @"perfect!"; imageview.image = [uiimage imagenamed:@"perfect"]; }
Comments
Post a Comment