Skip to content

Instantly share code, notes, and snippets.

@bguidolim
Created October 16, 2014 17:54
Show Gist options
  • Save bguidolim/b26bbad1d6bd29a1f3aa to your computer and use it in GitHub Desktop.
Save bguidolim/b26bbad1d6bd29a1f3aa to your computer and use it in GitHub Desktop.
int quizResult = [self.quizScore intValue];
if ( quizResult <= 10 ) {
self.lblResult.text = @"Você não foi nada bem!";
} else if ( quizResult <= 30 ) {
self.lblResult.text = @"Ainda podemos melhorar!";
} else if ( quizResult < 50 ) {
self.lblResult.text = @"Por pouco!";
} else if ( quizResult <= 70 ) {
self.lblResult.text = @"Bom desempenho!";
} else if ( quizResult <= 90 ) {
self.lblResult.text = @"Você foi muito bem!";
} else {
self.lblResult.text = @"Excelente desempenho, parabéns!";
}
NSString *quizScoreString = [NSString stringWithFormat:@"%d",quizResult/10];
self.lblQuiz.text = [NSString stringWithFormat:@"Desempenho no Quiz: %@",quizScoreString];
self.trophyViewContainer.backgroundColor = [UIColor clearColor];
NSNumber *starCount = [NSNumber numberWithInteger:0];
if (quizResult >= kMinToApprove) {
starCount = [NSNumber numberWithFloat:[self.quizScore floatValue]/100*3];
starCount = [NSNumber numberWithInteger:[starCount integerValue]];
}
VSStarView *starView = [[VSStarView alloc] initWithFrame:self.trophyViewContainer.frame
withStarCount:3
withFilledImageName:@"trophy-full"
withEmptyImageName:@"trophy-empty"
withFilledCount:starCount];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment