ios - How to call a label to display if the score is below e.g.:90 points? -
im making word game, there 2 possible labels "perfect!" shows when score 100 , "correct!" when score below 100,
but i'm having trouble calling "correct!" label when score goes below 100!
- (ibaction)btncheck:(id)sender { nsstring *answer = [_textbox.text stringbyreplacingoccurrencesofstring:@" " withstring:@""]; if([answer isequaltostring:@""]){ } else if ([answer isequaltostring:@"q"]) { _keyboard.hidden = yes; _textxclear.hidden = yes; //perfect button [_closeone sethidden:no]; [_wrongone sethidden:yes]; score = max (score +100, 0); [scorelabel settext:[nsstring stringwithformat:@"score: %d", score]]; coins = coins +5; if (score == 100) coins = 8; if (score == 0) coins = 0; if (score == 4) coins = 4; if (score == 3) coins = 3; if (score == 2) coins = 2; if (score == 1) coins = 1; [coinslabel settext:[nsstring stringwithformat:@"%d", coins]]; } else { [_wrongone sethidden:no]; score = min(score -5, 0); [scorelabel settext:[nsstring stringwithformat:@"score: %d", score]]; // animation shakes image (qimage) closeonechange.text = @"correct!"; }
the label called
closeonechange.text = "correct!";
how call show when score below 100, 99 & below must show "correct!" label?
try this,
if([answer isequaltostring:@""]){ ... } else { ... } if (score < 100) { closeonechange.text = "correct!"; } else { closeonechange.text = //set else condition text }
Comments
Post a Comment