iphone - how to check multiple buttons click and save the value on plist? -


i have 6 uibuttons.

  • easy

  • hard

  • plus

  • minus

  • divide

  • multiply

can click on "easy mode" or "hard mode" 1 button @ time?

can click on button , more 1 button same time(plus,minus,multiply,divide)?

now want on click buttons 1 or more @ time buttons value only.

means

  • easy- plus
  • easy- plus,minus
  • easy- plus, minus, divide
  • easy- multiply,divide,minus
  • easy- plus, minus, divide
  • easy- minus, multiply, plus

same "hard" case.

these conditions. want count common scores. how can store these values , save on nsmutablearray?

*if understood want here logic. can add/remove make upto requirement.

*directly typed here, errors/typos probable. please conside.

in interface file:

@property bool yourchoice;//0-easy, 1-hard @property bool plus; @property bool minus; @property bool divide; @property bool multipy; @property (strong) nsinteger score; @property (strong) nsmutablearray *scores; 

in implementation file:

-(ibaction)easy:(id)sender{     yourchoice=0; }  -(ibaction)hard:(id)sender{     yourchoice=1; } 

in choices action method, instead of tag checking title make readable.

//nsstring *title=[(uibutton *)sender currenttitle]; //to name in ios -(ibaction)choices:(id)sender{// have used osx style      nsstring *title=[(uibutton *)sender currenttitle];      if([title isequaltostring:@"plus"]) plus=1;      else if([title isequaltostring:@"minus"]) minus=1;      else if([title isequaltostring:@"divide"]) divide=1;      else if([title isequaltostring:@"multiply"]) multiply=1;      self.score=plus+minus+divide+miltiply; }  -(ibaction)showscore:(id)sender{    nsstring *choice=yourchoice?@"hard":@"easy";    nslog(@"score %@ %d.", choice, self.score);     self.scores[self.scores.count]=@(self.score);    //reset every value    youchoice=plus=minus=divide=multiply=score=0;  } 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -