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

vb.net - Alternative to the T-SQL AS keyword -

php - MySQLi binding parameters in a prepared statement doesn't work unless inserted after "WHERE" -

ios - CFRelease causing crash in iPad application -