uibutton - Code that saves button touch for iOS app -


i have bool that's character inside button.

-(ibaction)red:(id)sender{  human.image=[uiimage imagenamed:@"redman.png"];  redguy=yes;     //bool  if (redguy==yes){     red.hidden=no;     purpleguy=no;   //bool  } 

with above code, click on red button that's custom button , in viewdidload. when clicking red button, start game , play redguy instead of original purpleguy. when game ends , go viewdidload, redguy button clicked on didn't save. have click on redguy button again play him.

how make redman.png uiimage saved once press red button. want save if exit app , go in, start off redguy instead of having click redguy?

//the below code doesn't work saving bool inside button

[[nsuserdefaults standarduserdefaults]setbool:yes forkey:@"save"];  redguy= [[nsuserdefaults standarduserdefaults]boolforkey:@"save"];  //doesn't work or without redguy in front [[nsuserdefaults standarduserdefaults]synchronize]; 


Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -