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 uiimageviews 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

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -