ios - I'm creating a quiz game with 4 answers and I want to add score -


i'm creating quiz game 4 answers , want add score. every right answer worth 50 points , wrong answers -50 points. how do that?

- (ibaction)bpressed1:(id)sender {     if ([self.answer isequaltostring:@"a"]) {          uialertview *message = [[uialertview alloc] initwithtitle:@"yes!"                                                           message:@"+50."                                                          delegate:nil                                                 cancelbuttontitle:@"ok"                                                 otherbuttontitles:nil];         [message show];          [message release];          [self nextq];      }else{          uialertview *message = [[uialertview alloc] initwithtitle:@"no!"                                                           message:@"-50."                                                          delegate:nil                                                 cancelbuttontitle:@"ok"                                                 otherbuttontitles:nil]         [message show];          [message release];          [self nextq];     } } 

you can have @property (nonatomic) int score; in header file along uilabel display score. whenever presses correct answer, self.score+=50; , set label's text new score.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -